Subject | Re: [firebird-support] Handling Exceptions in Stored Procedures |
---|---|
Author | Helen Borrie |
Post date | 2005-05-05T03:12:11Z |
At 02:52 AM 5/05/2005 +0000, you wrote:
DataDef.pdf. If you don't have TFB, you can pick up all the gdscodes from
the Knowledgebase section of the main website (see tail message below).
./hb
>Is there an Example . Itried the following and I could not get it toYup. There is no syntax "WHEN EXCEPTION".
>compile.
> Any Ideas?
>CREATE PROCEDURE PROC_INJECT_PLUSALESWHEN GDSCODE unique_key_violation DO
>(
> ASTOREID VARCHAR(10),
> ASALESDATE TIMESTAMP,
> APLU VARCHAR(14),
> AQUANTITYSOLD FLOAT,
> ASALESEXGST FLOAT,
> ACOSTEXGST FLOAT,
> ASALESINCGST FLOAT,
> ACOSTINCGST FLOAT
>)
>AS
>BEGIN
> INSERT INTO PLUSALES
> ( STOREID, SALESDATE, PLU,
> QUANTITYSOLD, SALESEXGST,
> COSTEXGST, SALESINCGST, COSTINCGST )
> VALUES
> ( :ASTOREID, :ASALESDATE, :APLU,
> :AQUANTITYSOLD, :ASALESEXGST,
> :ACOSTEXGST, :ASALESINCGST, :ACOSTINCGST );
> /* WHEN EXCEPTION DO */
> BEGINStudy Chapter 32 of The Firebird Book, or read up on the little there is in
> UPDATE PLUSALES
> SET
> QUANTITYSOLD = :AQUANTITYSOLD,
> SALESEXGST = :ASALESEXGST,
> COSTEXGST = :ACOSTEXGST,
> SALESINCGST = :ASALESINCGST,
> COSTINCGST = :ACOSTINCGST
> WHERE
> ( STOREID = :ASTOREID )AND
> ( SALESDATE = :ASALESDATE )AND
> ( PLU = :APLU );
> END
>END;
DataDef.pdf. If you don't have TFB, you can pick up all the gdscodes from
the Knowledgebase section of the main website (see tail message below).
./hb