You need to
DECLARE SQLCODE INTEGER;
DECLARE SQLSTATE CHAR(5);
Don't ask me why.. The story is long and twisted.
Cheers
Serge
"sreeramoju" <db2udbdba-ezmlmshield-x75671204.[Email address protected]
wrote on 07/29/2005 05:48:05 AM:
>
> Hi Ekta,
>
> Please verify that the column and table names are specified correctly
> (including any required qualifiers) in the SQL statement.
>
> OR
>
> May be declaration of SQLCA is missing
>
> Thanks & Bestrgds
> Sreeramoju Pavan Kumar
>
> Tata Consultancy Services Limited
> International Tech Park,
> Innovator, 11th Floor,
> Whitefield Road,
> Bangalore - 560066,Karnataka
> India
> Mailto: sreeramoju.[Email address protected]
> Website: http://www.tcs.com
>
> No life is a waste, the only time we waste is the time we spend thinking
> we are alone
>
>
>
> "Ekta Rajpal " <db2udbdba-ezmlmshield-x46597859.[Email address protected]
> 07/29/2005 12:10 PM
>
> To
> "LazyDBA Discussion" <[Email address protected]
> cc
>
> Subject
> "SQLCODE" is not valid in the context !
>
>
>
>
>
>
> Hi All,
>
> I'm trying to insert a row in table. I have to raise and exception if for
> any reason(s) insert operation fails. I'm trying to achieve this by using
> SQLCODE and SIGNAL SQLSTATE but am getting an error. Here's the code that
> I'm trying to compile :
>
> INSERT INTO audit_row
> (raid, table_name, rid, action, action_date, userid)
> VALUES
> (raid, tabname, erid, act, CURRENT TIMESTAMP, NULL);
> -- Return a scary message if for some reason the statement failed.
> IF(SQLCODE = 100)
> THEN
> SIGNAL SQLSTATE '02000'
> SET MESSAGE_TEXT = 'Error creating Row Audit record. Contact
DBA';
> END IF;
>
> On compiling the procedure I get an error - SQL0206N "SQLCODE" is not
> valid in the context where it is used.
>
> Could some one please help me in understanding why "SQLCODE" is not valid
> in this context and how can I raise an exception in the above stated case
> !
>
> Regards,
> Ekta
>
>
> ---------------------------------------------------------------------
> PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> website: http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
>
> ForwardSourceID:NT00004DCE
>
>
> Notice: The information contained in this e-mail message and/or
> attachments to it may contain confidential or privileged
> information. If you are not the intended recipient, any
> dissemination, use, review, distribution, printing or copying of the
> information contained in this e-mail message and/or attachments to
> it are strictly prohibited. If you have received this
> communication in error, please notify us by reply e-mail or
> telephone and immediately and permanently delete the message and any
> attachments. Thank you
>
>
> ---------------------------------------------------------------------
> PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> website: http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
DB2 & UDB email list listserv db2-l LazyDBA home page