467,151 Members | 903 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,151 developers. It's quick & easy.

SQL-procedure-statement ....

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
  • viewed: 3347
Share:
4 Replies
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
"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
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
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.

Similar topics

10 posts views Thread by Dagwood | last post: by
9 posts views Thread by Grim Reaper | last post: by
3 posts views Thread by datapro01@yahoo.com | last post: by
10 posts views Thread by amjad | last post: by
6 posts views Thread by Fuzzydave | last post: by
14 posts views Thread by Developer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.