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 > Dynamic cursors

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-13-11, 01:55
kayal kayal is offline
Registered User
 
Join Date: Sep 2011
Posts: 8
Dynamic cursors

Hi,

I have a table with the following sample data.
Table 1:

S.No Table_Name Condition_Clause


1 xyz emp_id = 3
2 ABC Sal > 10000
3 KLM Age < 35

I've to write a DB2 procedure with "S.No" field as input and based on the input, it should select the "Table_Name" and the "Condition_Clause". I need to create a dynamic cursor using the "Table_Name" and "Condition_Clause" in the cursor definition "Select" statement and fetch the records from the cursor and process those records and insert new record in to some other table.

Is this scenario possible in DB2 Dynamic Cursors? For me it gives error for the dynamic cursor declaration. Can anyone help me on this with a sample code?

Thanks,
Kayal.
Reply With Quote
  #2 (permalink)  
Old 09-13-11, 02:12
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
all sample code is available in sample directory of dB2
or in doc
Stored procedure operators
why don't you publish the code and error you get
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
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