DB2 error : Keyword SELECT not expected. Valid tokens: FOR WITH WITHOUT

DB2 error : Keyword SELECT not expected. Valid tokens: FOR WITH WITHOUT

我正在尝试使用 iSeries Navigator 在 db2 数据库上执行以下存储过程:

CREATE PROCEDURE ZSPPQDELETEUSERIDBA ( 
    IN P_USERID CHAR(10) , 
    IN P_BUSINESSAREA CHAR(10))
    DYNAMIC RESULT SETS 1 

    LANGUAGE SQL 
    SPECIFIC ZSPPQDELETEUSERIDBA 
    NOT DETERMINISTIC 
    MODIFIES SQL DATA 
    CALLED ON NULL INPUT 
    SET OPTION  ALWBLK = *ALLREAD , 
    ALWCPYDTA = *OPTIMIZE , 
    COMMIT = *CS , 
    CLOSQLCSR = *ENDMOD , 
    DECRESULT = (31, 31, 00) , 
    DFTRDBCOL = *NONE , 
    DYNDFTCOL = *NO , 
    DYNUSRPRF = *USER , 
    RDBCNNMTH = *RUW ,
    SRTSEQ = *HEX 
    P1 : BEGIN 

    DECLARE TOTALCNT INTEGER DEFAULT 0 ; 

    DECLARE C1 CURSOR WITH RETURN TO CALLER
    SELECT Count (*) FROM USERBUSINESSAREA
     WHERE USERID            = P_USERID
       AND BUSINESSAREA = P_BUSINESSAREA;

    OPEN C1;
       FETCH C1 INTO TOTALCNT;

    IF ( TOTALCNT = 1) THEN 
        DELETE 
          FROM  USERBUSINESSAREA     
         WHERE  USERID       = P_USERID
           AND  BUSINESSAREA = P_BUSINESSAREA;
    END IF;
    END P1  ;

当我尝试执行上述过程时出现以下错误:

SQL State: 42601
Vendor Code: -199
Message: [SQL0199] Keyword SELECT not expected. Valid tokens: FOR WITH WITHOUT. Cause . . . . . :   The keyword SELECT was not expected here.  A syntax error was detected at keyword SELECT.  The partial list of valid tokens is FOR WITH WITHOUT. This list assumes that the statement is correct up to the unexpected keyword.  The error may be earlier in the statement but the syntax of the statement seems to be valid up to this point. Recovery  . . . :   Examine the SQL statement in the area of the specified keyword.  A colon or SQL delimiter may be missing. SQL requires reserved words to be delimited when they are used as a name. Correct the SQL statement and try the request again.

这里出了什么问题?

我发现问题 is.I 是为存储过程提供错误的输入值(即一个代替另一个..数据类型不同)。这导致了这个问题。现已解决