简体   繁体   中英

ERROR in DB2 stored procedure

What is wrong with following stored procedure?

CREATE PROCEDURE TEST
     (IN mbr VARCHAR(30),
      OUT sql_state CHAR(5)
    ) 
DYNAMIC RESULT SETS 1 LANGUAGE SQL BEGIN DECLARE SQLSTATE CHAR(5);
DECLARE rs CURSOR WITH RETURN TO CLIENT FOR
    SELECT
            *
        FROM
            A.XYZ;
OPEN rs;
SET
sql_state = SQLSTATE;

END @;

According to Info Center, SQL Code -104 means that you have an illegal symbol somewhere. In the full error message, it should give an indication to where that illegal symbol is located.

My guess is that something is confused about your statement terminators, have a look at this article .

If you are running this in command editor then you simply need to

Change your default termination character from semi-colon (;) to something else

and it will work.

You can see the IBM TechNote here : http://www-01.ibm.com/support/docview.wss?uid=swg21224723

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM