Subject | Re: [ib-support] help |
---|---|
Author | Helen Borrie |
Post date | 2003-01-30T10:57:52Z |
At 04:47 PM 30/01/2003 +0700, you wrote:
declaration is a complex DDL statement that can't be executed via a
single-statement dynamic SQL component such as TIBSQL.
that sets the line terminator to something other than a semicolon, since
the programming language (PSQL) subset needs the semicolon as the statement
terminator *within* the procedure body.
Create procedure begins the declaration, the last END statement ends it.
So, in a script, you might have set the terminator to be "cat-ears" - two
caret symbols ^^ using
SET TERM ^^ ;
then the last END statement in the procedure declaration would be
...
END ^^
...not doable in a single DSQL statement. Needs to be done in a script, or
in an an admin tool that can run scripts or otherwise simulate batched
statements.
heLen
>i am beginner,Advice: As a beginner, don't try to do this. A stored procedure
>
>i try to create procedure with my Delphi Program.This is my part of my code
>:
declaration is a complex DDL statement that can't be executed via a
single-statement dynamic SQL component such as TIBSQL.
> IBSQL.SQL.Clear;Your create procedure statement has to preceded by a SET TERM statement
> IBSQL.SQL.Add('CREATE PROCEDURE ITEMLIST '+
> 'RETURNS(ITEMNO VARCHAR(60),ITEMDESCRIPTION VARCHAR(100),QUANTITY
>NUMERIC(15,2)) '+
> 'AS '+
> ' Declare Variable QuantityPurchase Numeric(15,2); '+
> ' Declare Variable QuantitySales Numeric(15,2); ' +
> 'BEGIN '+
> ' for Select ItemNo,ItemDescription from Item into :ItemNo,
>:ItemDescription do '+
> ' begin '+
> ' Select Quantity from ItemHist where ItemNo = :ItemNo '+
> ' and JenisTransaksi = ''P'' <--- here's a syntax error (double
> quotes are invalid for strings..)
>into :QuantityPurchase; '+
> ' Select Quantity from ItemHist where ItemNo = :ItemNo '+
> ' JenisTransaksi = ''S'' <--- same error as above
>into :QuantitySales; '+
> ' Quantity = QuantityPurchase - QuantitySales; '+
> ' Suspend; '+
> ' end '+
> 'END'); <-- here's your terminaotr error
that sets the line terminator to something other than a semicolon, since
the programming language (PSQL) subset needs the semicolon as the statement
terminator *within* the procedure body.
Create procedure begins the declaration, the last END statement ends it.
So, in a script, you might have set the terminator to be "cat-ears" - two
caret symbols ^^ using
SET TERM ^^ ;
then the last END statement in the procedure declaration would be
...
END ^^
...not doable in a single DSQL statement. Needs to be done in a script, or
in an an admin tool that can run scripts or otherwise simulate batched
statements.
> IBSQL.ExecQuery;That's just Delphi delivering the exception message returned by the server.
>
>when that SQL Statement Execute, my Delphi Program Raise an Excepction:
>"Dynamic SQL Error SQL error code = -104 Token unknown -line 1,char 266 ?"
heLen