Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 09:01 AM
Raquel
Guest
 
Posts: n/a
Default 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.

  #2  
Old November 12th, 2005, 09:01 AM
Raquel
Guest
 
Posts: n/a
Default Re: SQL-procedure-statement ....

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.

  #3  
Old November 12th, 2005, 09:01 AM
Mark A
Guest
 
Posts: n/a
Default Re: SQL-procedure-statement ....

"Raquel" <raquel@nospam.com> wrote in message
news:fec2790d0268df678c90f4c8f89683bf@localhost.ta lkaboutdatabases.com...[color=blue]
> 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.
>[/color]

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


  #4  
Old November 12th, 2005, 09:01 AM
W Gemini
Guest
 
Posts: n/a
Default Re: SQL-procedure-statement ....

Raquel wrote:[color=blue]
> 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.
>[/color]
Try GO TO as two words.
  #5  
Old November 12th, 2005, 09:01 AM
Raquel
Guest
 
Posts: n/a
Default Re: SQL-procedure-statement ....

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.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.