I have a procedure that populates the orders table with all orders with a delivery date in a seven day period, beginning with today. What I would like to do is be able to specify a beginning and ending date with input parameters, to override the default one week period. The dates in the table are stored as integers in YYYYMMDD format.
Here is my current (working) procedure:
Here is my attempted update, which fails:
Running that I get:
Pointer not set for location referenced.
Application error. MCH3601 unmonitored by CVTORDERS at statement 0000000010, instruction X'0000'.
I'm sure it is probably something simple that I'm missing, but I'm not even sure what that error is complaining about. Any advice is appreciated.
Here is my current (working) procedure:
Code:
CREATE PROCEDURE CVTORDERS LANGUAGE SQL MODIFIES SQL DATA BEGIN DECLARE TODAY INTEGER; SET TODAY = (SELECT YEAR(CURRENT DATE) * 1000 + MONTH(CURRENT DATE) * 100 + DAY(CURRENT DATE) FROM SYSIBM.SYSDUMMY1); DELETE FROM ORDTABLE; INSERT INTO ORDTABLE SELECT ACCT, ITEM, QTY, PRICE, WKDAY FROM V_ORDERS WHERE DDATE BETWEEN TODAY AND TODAY + 6; END
Code:
CREATE PROCEDURE CVTORDERS (IN SDATE INTEGER, IN EDATE INTEGER) LANGUAGE SQL MODIFIES SQL DATA BEGIN DECLARE TODAY INTEGER; SET TODAY = (SELECT YEAR(CURRENT DATE) * 1000 + MONTH(CURRENT DATE) * 100 + DAY(CURRENT DATE) FROM SYSIBM.SYSDUMMY1); IF SDATE IS NULL THEN SET SDATE = TODAY; END IF; IF EDATE IS NULL THEN SET EDATE = TODAY + 6; END IF; DELETE FROM ORDTABLE; INSERT INTO ORDTABLE SELECT ACCT, ITEM, QTY, PRICE, WKDAY FROM V_ORDERS WHERE DDATE BETWEEN SDATE AND EDATE; END
Pointer not set for location referenced.
Application error. MCH3601 unmonitored by CVTORDERS at statement 0000000010, instruction X'0000'.
I'm sure it is probably something simple that I'm missing, but I'm not even sure what that error is complaining about. Any advice is appreciated.
Comment