Hi All,
I have a DS Server routine where I am trying to insert a record in DB2 table. Below is the routine code used and after that error I am getting is posted. Somehow those single quotes are not appearing for varchar fields and its giving this error. Any inputs how to correct this syntax. Have tried lot options
QueryCmd = "db2 -mv " : "'Insert into STG.JOB_CNTL(CDC_STG_BATCH_ID, JOB_NAME, STATUS) Values ( ":v_BatchId:",":jobname:",'Success')';"
Call DSExecute('UNIX',QueryCmd,Output,ReturnVal)
seq_routine..JobControl (DB2INSERT): THE return value of query is :Insert into STG.JOB_CNTL(CDC_STG_BATCH_ID, JOB_NAME, STATUS) Values ( 1111,test_11dec,Success)
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0206N "TEST_11DEC" is not valid in the context where it is used.
SQLSTATE=42703
DB2 Syntx giving trouble in Server routine
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
My guess is that you need single quotes around the value TEST_11DEC
For example, and assuming that this is a value for the second parameter in the Insert statement (jobname):
QueryCmd = "db2 -mv " : "'Insert into STG.JOB_CNTL(CDC_STG_BATCH_ID, JOB_NAME, STATUS) Values ( ":v_BatchId:", '":jobname:"' ,'Success')';"
Call DSExecute('UNIX',QueryCmd,Output,ReturnVal)
For example, and assuming that this is a value for the second parameter in the Insert statement (jobname):
QueryCmd = "db2 -mv " : "'Insert into STG.JOB_CNTL(CDC_STG_BATCH_ID, JOB_NAME, STATUS) Values ( ":v_BatchId:", '":jobname:"' ,'Success')';"
Call DSExecute('UNIX',QueryCmd,Output,ReturnVal)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.