If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > can not create exception handler

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-17-08, 23:24
smell smell is offline
Registered User
 
Join Date: Dec 2008
Posts: 3
can not create exception handler

I tried to create a sp in db2 as400. I got following error. no idea why

CREATE PROCEDURE PROFILESCHEDULESCAN (
IN INSYSDATE DATE,
OUT p_sqlstate_out CHAR(5),
OUT p_sqlcode_out INT)
LANGUAGE SQL
SPECIFIC PROFILESCHEDULESCAN
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
SET OPTION ALWBLK = *ALLREAD ,
ALWCPYDTA = *OPTIMIZE ,
COMMIT = *NONE ,
DECRESULT = (31, 31, 00) ,
DFTRDBCOL = *NONE ,
DYNDFTCOL = *NO ,
DYNUSRPRF = *USER ,
SRTSEQ = *HEX
PSS: BEGIN
DECLARE SQLCODE INTEGER DEFAULT 0 ;
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';

DECLARE CONTINUE HANDLER FOR SQLSTATE '23503'
VALUES (SQLSTATE, SQLCODE)
INTO p_sqlstate_out
,p_sqlcode_out;

DECLARE INTERNALID INTEGER DEFAULT 0 ;
END PSS ;

Message: [SQL0104] Token INTERNALID was not valid. Valid tokens: EXIT UNDO CONTINUE. Cause . . . . . : A syntax error was detected at token INTERNALID. Token INTERNALID is not a valid token. A partial list of valid tokens is EXIT UNDO CONTINUE. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token INTERNALID. Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause.
Reply With Quote
  #2 (permalink)  
Old 12-18-08, 00:07
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
I don't know about iSeries, but on in DB2 LUW compound statements variable declarations must come before exception handlers.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On