Skip to content
Advertisement

Unexpected token “” was found following “”

Im a newbie to DB2. Im trying to convert this sp from Microsoft SQL server to DB2 Here is the sp from Microsoft SQL:

and this is the sp after i converted to DB2

Then i got this error: An unexpected token “” was found following “”. Expected tokens may include: “”.. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.19.56

Does anyone know how to resolved this error. Thanks

Advertisement

Answer

Db2 compound SQL statements that comprise bodies of stored procedures require that DECLARE statements precede any executable statements and follow a well defined order, as shown in the linked documentation. In your code they are scattered all over the place, which is what the error message is trying to tell you.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement