Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Balance amt using SQL from Parent-Child and GrandMaster
Message
 
À
08/12/2004 01:28:01
Dorin Vasilescu
ALL Trans Romania
Arad, Roumanie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
00966900
Message ID:
00967682
Vues:
17
Hi Dorin

>Yes, exactly.
>You need to test, though, if queries don't become slower (the same occur in VFP when UDFs are used)

Thanks to you I was able to write my first stored procedure in FireBird.

I have just posted this in FireBird Support as I am getting a Function Unknown message
Hi all

I have a stored procedure as below.  The return value of the stored 
procedure I want to use in the SELECT statement of mine.  Currently I have 
tried to utilize it this way and I receive an error stating that the 
"Function Unknown OSACCTDRAMT".  Upper Lower case of the function name does 
not seem to be a problem.

SELECT OSAcctDrAmt(s.bDrAmt, uf.bDr, uf.bCr) AS bBalDr
    FROM tAccountsJV t
       JOIN sAccountsJV s
          ON s.iPID = t.iID
             AND s.iAcctID = 485
       LEFT JOIN uOSAccounts uf
          ON uf.iPID = t.iID
             OR uf.iSID = t.iID ;

The Stored Procedure is as follows;

SET TERM ^ ;

CREATE PROCEDURE OSACCTDRAMT (
     BDRAMT DOUBLE PRECISION,
     BDR DOUBLE PRECISION,
     BCR DOUBLE PRECISION)
RETURNS (
     BOSDRAMT DOUBLE PRECISION)
AS
begin
     bOSDrAmt = CASE WHEN (bDrAmt > 0 AND bCr > 0) THEN bDrAmt - bCr
                     WHEN (bDrAmt > 0 AND bDr > 0) THEN bDrAmt - bDr
                     WHEN (bDr IS NULL AND bCr IS NULL) THEN bDrAmt
                     ELSE 0 END ;

   suspend;
end
^

SET TERM ; ^

GRANT EXECUTE ON PROCEDURE OSACCTDRAMT TO SYSDBA;
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform