View previous topic :: View next topic |
Author |
Message |
ssd Beginner
Joined: 24 Mar 2006 Posts: 25 Topics: 10
|
Posted: Sun Apr 15, 2007 11:33 pm Post subject: error while executing Dynamic SQL |
|
|
I am trying to execute a dynamic SQL in REXX using DSNREXX environment . But I am encountering -199 SQLCODE while preparing the statement. The following is the piece of code that I am using. Pls help me resolving this.
Code: |
S2 = "EXECSQL ",
" SELECT '1' ",
" INTO :COLCHK",
" FROM SYSIBM.SYSCOLUMNS ",
" WHERE ",
" NAME = '"COLNAME"'",
" AND TBNAME = '"PTABLE.CNT"'",
" AND TBCREATOR = '"creator_name"'"
SQLSTMT2 = S2
address dsnrexx "EXECSQL PREPARE S2 INTO :SQLDA FROM :SQLSTMT2"
SAY SQLCODE |
|
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Mon Apr 16, 2007 4:42 am Post subject: |
|
|
This is a syntax error. Use TRACE to display the generated SQL statement; also, display SQLERRM to see some more info.
O.
________
grape ape pictures
Last edited by ofer71 on Sat Feb 05, 2011 11:59 am; edited 1 time in total |
|
Back to top |
|
 |
ssd Beginner
Joined: 24 Mar 2006 Posts: 25 Topics: 10
|
Posted: Mon Apr 23, 2007 7:28 am Post subject: |
|
|
I used a cursor to execute the query. now it works
Thanks
ssd |
|
Back to top |
|
 |
|
|