Why does the keyword END is not accepted at the end of a stored proc ?

5 pts.
IBM iSeries
Hey guys,  I have thise error in SQL stored proc.  I'm on ISERIES and I use RUNSQLSTM to very my procedure. could you help ?  It's seem I can't put a END at the end! ---------------------     160            AND DUDGCT = CDCODE                                              161            AND SUBSTRING(CDCEL3,1,4) = (                                    162      SELECT CLSTHE FROM LIDCOS/IHCCLASS WHERE TYPREG = TYPE_REG AND         163                                   CLSTHE = SUBSTRING(CDCEL3,1,4)));         164 END;                                                                                                     * * * * *  E N D  O F  S O U R C E  * * * * * SQL0204  20       1  Position 1 IHC111S in LIDCOS type *N not found.            5722SS1 V5R4M0 060210               Run SQL Statements             IHC111S      Record  *...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 SQL0104  30     164  Position 4 Token ; was not valid. Valid tokens: CASE.      SQL7961   0          Rollback completed.                                                            Message Summary                                               Total     Info   Warning      Error   Severe  Terminal                              3        1         0          1        1         0                        30 level severity errors found in source            

Software/Hardware used:

Answer Wiki

Thanks. We'll let you know when a new response is added.

The message is saying that the semi-colon was encountered where one wasn’t expected. It goes on to say that CASE should be the token that would be after END under the circumstances.

I suspect that the full source member is not actually a CREATE PROCEDURE operation. If it’s instead a basic SQL statement, then it’s not a “procedure” at all. It’s just a statement (or series of statements delimited by “;”) to be executed.

If you are attempting to create a stored procedure with a CREATE PROCEDURE statement, then it would also be possible to have a BEGIN/END block where the END statement could be followed by the label of the BEGIN statement.

Nornally, if there is no BEGIN statement used in a stored procedure, there is no use for an END statement.


Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: