SPL Problem for you????
Posted in 1997
Topics: SQL Development & Query Writing, Stored Procedures & SPL, Jobs, Consulting & Announcements
Hello Informix World!
Is there any thing wrong with the following Proc ?????
Appreciate your help.
CREATE PROCEDURE PROC_SO_OUTSTAND (SELBLT CHAR(5))
BEGIN
ON EXCEPTION IN (-310) --- If table exist then drop it
DROP TABLE temp_so_nextdate; END EXCEPTION WITH RESUME
SELECT MIN(payment_date) as payment_date,so_no, amount as payamount
FROM so_payments WHERE paid_ind = 0 and process_date IS NULL
group by so_no,amount INTO TEMP temp_so_nextdate;
END
BEGIN
ON EXCEPTION IN (-310) -- if Table exist then drop it
DROP TABLE temp_so_outstand; END EXCEPTION WITH RESUME
IF SELBLT = 'ALL' then
SELECT A.*, b.blt,B.received_date,B.so_type,B.so_freq,B.cust_name,
B.cust_type,B.start_date,B.end_date,B.servchrg_type,B.postingreport_on
FROM temp_so_nextdate A, so_custinfo B where A.so_no = b.so_no AND
(B.end_date > A.payment_date OR B.end_date > TODAY OR B.end_date IS
NULL)
AND B.so_status = 0 INTO TEMP temp_so_outstand;
ELSE
SELECT A.*, B.blt,B.received_date,B.so_type,B.so_freq,B.cust_name,
B.cust_type,B.start_date,B.end_date,B.servchrg_type,B.postingreport_on
FROM temp_so_nextdate A, so_custinfo B where B.blt = SELBLT AND
A.so_no = B.so_no AND (B.end_date > A.payment_date OR B.end_date >
TODAY
OR B.end_date IS NULL) AND B.so_status = 0 INTO TEMP temp_so_outstand;
END IF
DROP TABLE temp_so_nextdate; END
END PROCEDURE;