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 > Second Cursor not inserting the Data.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-12, 09:06
Rajesh1203 Rajesh1203 is offline
Registered User
 
Join Date: Aug 2010
Posts: 38
Second Cursor not inserting the Data.

Hello All,
I am working on a stored procedure to insert data into two tables.I have written a stored procedure with two cursors for that.Problem is when I call the procedure data is successfully inserted into the first table but the second table is still empty.

The only link between the two cursors is first cursor inserts data into a table and the second cursor reads the same data.

can some one help me with this.
Attached Files
File Type: txt POSTING.txt (2.5 KB, 5 views)
Reply With Quote
  #2 (permalink)  
Old 01-05-12, 09:26
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You need to set NOT_FOUND to 'N' after the loop for the first cursor. When the first cursor hit the end, you condition handler is setting NOT_FOUND = 'Y', which will exit the loop. You use the same check for the second loop,k but you never reset NOT_FOUND which is now 'Y'.

Andy
Reply With Quote
  #3 (permalink)  
Old 01-05-12, 20:32
Rajesh1203 Rajesh1203 is offline
Registered User
 
Join Date: Aug 2010
Posts: 38
Quote:
Originally Posted by ARWinner View Post
You need to set NOT_FOUND to 'N' after the loop for the first cursor. When the first cursor hit the end, you condition handler is setting NOT_FOUND = 'Y', which will exit the loop. You use the same check for the second loop,k but you never reset NOT_FOUND which is now 'Y'.

Andy
Thanks that helped.
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