View previous topic :: View next topic
|
Author |
Message |
srajanbose
New User
Joined: 11 Oct 2004 Posts: 69 Location: chennai
|
|
|
|
My requirement is to execute the below sql query
Code: |
SQLSTMT= "SELECT NAME FROM SYSIBM.SYSCOLUMNS",
"WHERE TBCREATOR='CI1'",
"AND NAME IN (SELECT NAME FROM SYSIBM.SYSCOLUMNS" ,
"WHERE TBCREATOR='CI1' AND TBNAME=TABNAME1 AND KEYSEQ > 0 )"
|
I want to pass the TABNAME1 value dynamically. How to acheive this in Rexx. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
if You are using the REXX sql interface the sql query is just a REXX string
and can be built by concatenating the needed fragments
Code: |
get the query variables ... for example with
parse arg creator tablnam
.......
SQLSTMT= "SELECT NAME FROM SYSIBM.SYSCOLUMNS" || ,
"WHERE TBCREATOR='" || creator || "'" || ,
"AND NAME IN (SELECT NAME FROM SYSIBM.SYSCOLUMNS" || ,
"WHERE TBCREATOR='" || creator || "'" || ,
"AND TBNAME='" || tablnam || "'" || ,
"AND KEYSEQ > 0 )"
|
the above snippet only shows how to build the query string from Your sample
is not concerned about sql goodness |
|
Back to top |
|
|
|