Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any sample working code or tutorial for dynamic sql in db2 procedures

 
Biju moozhikkara
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Can any body provide me with Any sample working code or tutorial for dynamic sql in db2 procedures.

i need to change certain part of sql statment, like order by field dynamcally.

Regards
Biju M
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34401
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Biju,
A quick google search found this example. Are you looking for something more specific?
 
Biju moozhikkara
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Jeanne ,
Thanks for the link.But i was looking for dynamic sql embedded in db2 stored procedure. hope that is very much possible.

Regards
Biju M
 
Sagar Dafle
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the SIMPLEST SP that i executed ..

CREATE PROCEDURE SP_SAMPLE()
DYNAMIC RESULT SETS 1
BEGIN
DECLARE c CURSOR WITH RETURN FOR
SELECT * FROM sagar123.emp;
OPEN c;
END
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic