I've compiled other stored procedures (from SQuirrel© v4.8) and was able to figure out the error messages sufficiently to find my errors until I get a successful compile. But this time I'm getting the following unhelpful, cryptic information.
Error: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=);Y', 'CSUMMRY_RECORD';), DRIVER=4.33.31
SQLState: 42601
ErrorCode: -104
I've previously interpreted this as the SQLERRMC=) part is where the failure occurred; the Y', 'CSUMMRY_RECORD' part is the text immediately before the failure; and, the ), part is the possible token(s) expected next. Well, if it failed on a right-paren and a right-paren was expected next, then why is that an error?
Anyway, I do find one place where that sequence occurs--in the first row of a multi-row insert into a temporary table. But the documentation says this syntax is supported by DB2 LUW.
INSERT INTO SESSION.MyConstraints ( MyType, MyLabel, MyTable, MyParent, MyList ) VALUES
( ('TABLE', 'CSUMMRY', 'CSUMMRY_RECORD'),
('ARRAY', 'CHK_VT', 'CSUMMRY_RECORD_CSUM_CHECKS_VT', 'CSUMMRY_RECORD', '( CSUM_CORP,CSUM_BANK,CSUM_PERIOD )'),
('ARRAY', 'DEP_VT', 'CSUMMRY_RECORD_CSUM_DEPOSITS_VT', 'CSUMMRY_RECORD', '( CSUM_CORP,CSUM_BANK,CSUM_PERIOD )'),
('CHECK', 'CSUMMRY', 'CSUMMRY_RECORD', NULL, '( CSUM_BANK = ''L'' OR CSUM_BANK = ''X'' )'),
('CHECK', 'CHK_VT', 'CSUMMRY_RECORD_CSUM_CHECKS_VT', 'CSUMMRY_RECORD', '( CSUM_BANK = ''L'' OR CSUM_BANK = ''X'' )'),
('CHECK', 'DEP_VT', 'CSUMMRY_RECORD_CSUM_DEPOSITS_VT', 'CSUMMRY_RECORD', '( CSUM_BANK = ''L'' OR CSUM_BANK = ''X'' )')
);
So, I want to confirm the failing line number. I've done my research and found the following two methods that seem to be run-time solutions. Correct?
SQLCA...SQLERRD(3)field, andGET DIAGNOSTICS...DB2_LINE_NUMBERis apparently not a DB2 LUW thing.
I also tried the following--to no avail (only a null value returned).
ValuesDBMS_UTILITY.FORMAT_CALL_STACK()ValuesDBMS_UTILITY.FORMAT_ERROR_BACKTRACE()
Is there any other means of finding out the failing line number of a stored procedure at compile time?
ADDITIONAL NOTE: I did find how to change this message format:
- Error: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=);Y', 'CSUMMRY_RECORD';), DRIVER=4.33.31
To this slightly more helpful message format:
- Error: An unexpected token ")" was found following "Y', 'CSUMMRY_RECORD'". Expected tokens may include: ")".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.33.31
I added the following to the URL for the remote database:
- mydatabase:retrieveMessagesFromServerOnGetMessage=true;
But I still want to know if there are any other means of finding out the failing line number of a stored procedure at compile time?
DECLARE GTTandINSERT INTO. It's definitely not supported syntax. This site doesn't support GTT declarations, but you may amendCREATE TABLEto yourDECLARE GTT+ setON COMMIT PRESERVE ROWSat the end. Note your wrong number of columns in the 1-st row as wellINSERT...VALUESintroduces one or more rows of values to be inserted."