Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Passing Dynamic variable to DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
karthikxan

New User


Joined: 28 Nov 2007
Posts: 7
Location: chennai

PostPosted: Wed May 27, 2009 3:58 pm    Post subject: Passing Dynamic variable to DB2
Reply with quote

Hi,

I have a query i have a requirement like this,
in run time i have to give table name

its like this

EXEC SQL

SELECT colname from TNAME Where some condition

END-EXEC

The TNAME will be passed dymanically,is it possible can you please let me know your suggestions
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Wed May 27, 2009 4:01 pm    Post subject: Reply to: regarding DB2
Reply with quote

read the manual about dynamic sql
there is a link to the manuals at the top of the page
Back to top
View user's profile Send private message
karthikxan

New User


Joined: 28 Nov 2007
Posts: 7
Location: chennai

PostPosted: Wed May 27, 2009 5:18 pm    Post subject:
Reply with quote

Hi my question is

whether i can pass a table name dynamically into SQL statement

Regards
Karthik
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Wed May 27, 2009 5:23 pm    Post subject: Reply to: Passing Dynamic variable to DB2
Reply with quote

NO!
but You can use dynamic sql to build dynamically any query

at the top of the page there is a link to the manuals so that You can read about dynamic sql

edited to add a good reference ( thanks to expat !)
http://www.redbooks.ibm.com/redbooks/pdfs/sg246418.pdf
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Creating a dynamic sort card in JCL u... ChitraChhabra DFSORT/ICETOOL 4 Wed Aug 03, 2016 6:15 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us