View previous topic :: View next topic
|
Author |
Message |
shreejita
New User
Joined: 16 Aug 2009 Posts: 60 Location: chennai
|
|
|
|
Hi,
I am using dynamic SQL in COBOL-DB2 program and following are the declaration made in program.
01 US.
49 US-LEN PIC S9(4) COMP.
49 US-TEXT PIC X(80).
PROCEDURE DIVISION.
MOVE 40 TO US-LEN.
ACCEPT US-TEXT.
EXEC SQL
EXECUTE IMMEDIATE :US
END-EXEC.
I am accepting US-TEXT , the SQL statement as sting from SYSIN DD * as like this
//SYSIN DD *
'DELETE FROM tbname WHERE EMPCD = "A002" '
/*
i am getting SQLCODE -104 during runing of program and checked with manual saying that it is sysntax error.
Please solve this. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
display your complete sqlca message, which will inidicate which token db2 has decided to flag as in error.
having no idea how you are executing your program,
the connect that has been/not been made,
it could simply be the qualification fo your tbname.
-104 is a rather specific type of 'syntax' error....................
Quote: |
Please solve this.
|
solve it yourself. |
|
Back to top |
|
|
shreejita
New User
Joined: 16 Aug 2009 Posts: 60 Location: chennai
|
|
|
|
i changed the quotes like this
//SYSIN DD *
'DELETE FROM EMPI WHERE EMPCD = 'A002''
/*
Now i am receiving SQLCODE -010 which says string not terminated properly
what z the meaning of that |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
why do you have quotes around the whole statement ?
try this :
//SYSIN DD *
DELETE FROM EMPI WHERE EMPCD = 'A002'
/*
or
//SYSIN DD *
DELETE FROM EMPI WHERE EMPCD = "A002"
/*
depending on your settings |
|
Back to top |
|
|
shreejita
New User
Joined: 16 Aug 2009 Posts: 60 Location: chennai
|
|
|
|
Thanks ALL, It is working now. |
|
Back to top |
|
|
|