By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,586 Members | 2,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,586 IT Pros & Developers. It's quick & easy.

SQL-procedure-statement ....

P: n/a
This is regarding SQL stored procedures. The guide says this about handler
declaration in SQL procedures:

"handler declaration can specify a SQL-procedure-statement.
SQL-procedure-statement is a set of statements that execute when the
handler receives control."

But I don't understand how a 'set of statements' can be specified as a
SQL-procedure-statement when UDB does not allow nested compound
statements.

Also, any idea why I cannot use the following in SQL procedure:

DECLARE CONTINUE HANDLER FOR SQLEXCEPTION GOTO ERROR_HANDLE;

The above line gives an error during CREATE PROCEDURE: SQL0104N - An
unexpected token GOTO was found; expected tokens may include SET.

Thanks.
Raquel.

Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Continuing with the above question, at one place, the manual states that
both the SQLSTATE and SQLCODE variables can be declared only in the
'outermost' compound statement of the SQL procedure.

And then, it of course says that compund statements cannot be nested.

If they cannot be nested, what does 'outermost' compound statement mean?

Think I am missing some fundamental here.

TIA
Raquel.

Nov 12 '05 #2

P: n/a
"Raquel" <ra****@nospam.com> wrote in message
news:fe******************************@localhost.ta lkaboutdatabases.com...
This is regarding SQL stored procedures. The guide says this about handler
declaration in SQL procedures:

"handler declaration can specify a SQL-procedure-statement.
SQL-procedure-statement is a set of statements that execute when the
handler receives control."

But I don't understand how a 'set of statements' can be specified as a
SQL-procedure-statement when UDB does not allow nested compound
statements.

Also, any idea why I cannot use the following in SQL procedure:

DECLARE CONTINUE HANDLER FOR SQLEXCEPTION GOTO ERROR_HANDLE;

The above line gives an error during CREATE PROCEDURE: SQL0104N - An
unexpected token GOTO was found; expected tokens may include SET.

Thanks.
Raquel.


I would recommend the following book on stored procedures;
"DB2 SQL Procedural Language for Linux, UNIX, and Windows"
By Paul Yip, Drew Bradstock, Hana Curtis, Michael Gao, Zamil Janmohamed,
Clara Liu, Fraser McArthur
Published by Prentice Hall PTR.

You can download Chapter 5. "Exception Handling" for free at:
http://www-106.ibm.com/developerwork...p/splbook.html
Nov 12 '05 #3

P: n/a
Raquel wrote:
This is regarding SQL stored procedures. The guide says this about handler
declaration in SQL procedures:

"handler declaration can specify a SQL-procedure-statement.
SQL-procedure-statement is a set of statements that execute when the
handler receives control."

But I don't understand how a 'set of statements' can be specified as a
SQL-procedure-statement when UDB does not allow nested compound
statements.

Also, any idea why I cannot use the following in SQL procedure:

DECLARE CONTINUE HANDLER FOR SQLEXCEPTION GOTO ERROR_HANDLE;

The above line gives an error during CREATE PROCEDURE: SQL0104N - An
unexpected token GOTO was found; expected tokens may include SET.

Thanks.
Raquel.

Try GO TO as two words.
Nov 12 '05 #4

P: n/a
Had tried GO TO even earlier but didn't help. Anyway, thank you so much for
an earlier post on dbforms.com which helped me solve another nagging
problem I was facing for Create procedures (SQL1131N).

Regards,
Raquel.

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.