It looks ok.
Is it possible that P_FROMDATE is a smallint, which cause
SUBSTR(CHAR(P_FROMDATA),7,2) out of range?
Would you please give a result of
CHAR(P_FROMDATA), and LENGTH(CHAR(P_FROMDATA)) inside your stored proc?
BTW, which db2 you are using? db2 for LUW(linux/unix/windows) for db2 for 390?
Quote:
Originally posted by ChanOnna
Hi,
I'm having some trouble converting an integer to a date and setting it to a variable...
Here is the code:
...
DECLARE D_FROMSTARTDATE DATE;
SET D_FROMSTARTDATE = DATE (SUBSTR(CHAR(P_FROMDATE),5,2) || '/' || SUBSTR(CHAR(P_FROMDATE),7,2) || '/' || SUBSTR(CHAR(P_FROMDATE),1,4) );
...
P_FROMDATE is a parameter, coming in as an INTEGER.
The error message when trying to deploy the stored procedure is:
SQL0440N No Authorized routine named "SUBSTR" of type "FUNCTION" having compatible arguements was found.
Thanks for any advice.
|