By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,021 Members | 912 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,021 IT Pros & Developers. It's quick & easy.

using Dynamic SQL for Update

P: 1
Hai,
i would like to use dynamic sql for update records in the DB@ db.
Means, the value to be updated will be send as concatenated string.
Then based on the concatnation value i need to retrieve the records into cursor..then update the set..
how can i do that..

say for example,
i would like to update the salary for all the employees in my company.
I have different grade of employee. In my User interface(.net )i can view all the employees belongs to Admin Department. In admin i may have cleark, Admin assitant, admin officer..All the three are different grade..so salary will be updated based on the category. so i will be passing
Grade, salary as input parameter. i would like to write the Update statement for this. Pls help me...Im very very new to DB2.
Now my idea is first, retrieve the record into cursor based on the input parameter(using dynamic SQL) - [i would like to use dyanmic sql as, i may have more than one record at any time of update..so instead of going to database everytime,i just want to pass the input parameter in one stretch, whatever the logic i need to do, can do in SP.].
then update each record by looping the cursor...
Can i do that...can someone send me simple exmaple to loop the cursor.
Thanks
Sara
Aug 12 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.