If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > V8 WinNT: Compiling recursive stored procedures

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-04, 04:46
deepaka deepaka is offline
Registered User
 
Join Date: Jan 2004
Posts: 20
Question V8 WinNT: Compiling recursive stored procedures

Hi All,

I am running db2 V 8 on Windows NT. How can I compile a function/stored procedure that contains recursive call? I scanned the archives and found that the recursive call can be deferred untill runtime using execute immediate. But when I tried:

CREATE PROCEDURE ADMINISTRATOR.PROCEDURE1 ( )
------------------------------------------------------------------------
-- SQL Stored Procedure
------------------------------------------------------------------------
P1: BEGIN
execute immediate "call procedure1()";
END P1

the compiler said:
ADMINISTRATOR.PROCEDURE1: 9: [IBM][CLI Driver][DB2/NT] SQL0113N "call procedure1()" contains a character that is not allowed or does not contain any characters. LINE NUMBER=9. SQLSTATE=42601

What's the problem....

Thanks and Regards
Deepak Ajmera
Reply With Quote
  #2 (permalink)  
Old 02-03-04, 09:39
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Deepak,
Try it this way:

DECLARE stmt varchar(200);

SET stmt = 'CALL mySchema.MyProc(?,?)';

execute stmt into outVar1, out var2 using invar1, invar2;

The samples in the "SQL Reference" and the "DB2 SQL Procedural Language for Linux, UNIX, and Windows" book do it this way.

HTH

Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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