wood burning stoves 2.0
The moose likes JDBC and Relational Databases and the fly likes Any sample working code or tutorial for dynamic sql in db2 procedures Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Any sample working code or tutorial for dynamic sql in db2 procedures " Watch "Any sample working code or tutorial for dynamic sql in db2 procedures " New topic
Author

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

Biju moozhikkara
Greenhorn

Joined: Oct 21, 2005
Posts: 20
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

Joined: May 26, 2003
Posts: 31419
    
184

Biju,
A quick google search found this example. Are you looking for something more specific?


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Biju moozhikkara
Greenhorn

Joined: Oct 21, 2005
Posts: 20
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

Joined: Nov 06, 2012
Posts: 18
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
 
jQuery in Action, 2nd edition
 
subject: Any sample working code or tutorial for dynamic sql in db2 procedures