Page 1 of 1

SQL code -104 while executing a stored procedure

PostPosted: Sat Oct 02, 2010 1:18 am
by upendra_water
I am facing SQL code -104 while executing a stored procedure.
I have used a dynamic cursor and while preparing the cursor it is throwing SQLCODE -104.

Cursor is declared as follows:
EXEC SQL
DECLARE C1 ASENSITIVE SCROLL CURSOR
WITH ROWSET POSITIONING WITH HOLD FOR DYNAMQRY
END-EXEC.

Prepare statement:
EXEC SQL
PREPARE DYNAMQRY FROM :W600-RESULT-STRING
END-EXEC

Here W600-RESULT-STRING is defined as
01 W600-RESULT-STRING.
49 W600-RESULT-STRING-LEN PIC S9(04) COMP.
49 W600-RESULT-STRING-TXT PIC X(3000).

Can anyone please look into this? Please let me know if I need to furnish more information.

Re: SQL code -104 while executing a stored procedure

PostPosted: Sat Oct 02, 2010 3:27 am
by dick scherrer
Hello,

Did you read about the -104?

http://publibz.boulder.ibm.com/cgi-bin/ ... 0/2.1.6.12

What does W600-RESULT-STRING-TXT CONTAIN?

Re: SQL code -104 while executing a stored procedure

PostPosted: Sat Oct 02, 2010 4:04 am
by upendra_water
Hi Dick,

Thank you so much for your quick response.
I read the information.

ILLEGAL SYMBOL "token". SOME SYMBOLS THAT MIGHT BE LEGAL ARE:
token-list

A syntax error was detected where the symbol "token" occurs in the SQL
statement. The list of symbols that might be legal shows some alternate
symbols that could possibly be correct at that point, if the preceding
part of the statement is entirely correct.

Can you please tell me what is "token" and token-list??

W600-RESULT-STRING-TXT contains SQL query.
For some reasons I will not be able to publish the query.
But just wanted to know if this error is because of syntax error while preparing the query?

Re: SQL code -104 while executing a stored procedure

PostPosted: Sat Oct 02, 2010 5:44 am
by dick scherrer
Hello,

For some reasons I will not be able to publish the query.

Then it will be very difficult for anyone to help. Also, for what it is worth, the code to a query can be published - just change the "secret" values to something else. . . Keeping the code consistent.

But just wanted to know if this error is because of syntax error while preparing the query?
Yes, possibly.

Copy/paste the query into spufi or a batch job and see if it works.