I am trying to deploy a stored procedure into DB2. Unfortunately, I keep getting the following error message:
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:....
Expected tokens may include: "<space>". SQLSTATE=42601
When I look at the code, I simply have a semi-colon after each SQL statement but for some reason I am still getting this error.
I see the code in cmd looks more structured now. But I am still getting this error message:
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "END" was found following " END WHILE; ".
Expected tokens may include: "END". LINE NUMBER=398. SQLSTATE=42601
The line it is referencing has the following code: END WHILE;
You probably still have your terminator wrong.
Take a look at the many sample stored procedures that IBM provides you in the directory c:\program files\ibm\sqllib\samples\sqlpl.
Look at the files that have extensions *.DB2
Very strange. I decided to run my stored procedure from a SQL editor tool and it compiled and I see it in the DB. I ran the same query in command prompt and I still get the same messages. Not sure why that's the case.