I've written a short procedure when a donor id is input it checks for active pledge based on status field (NUMBER for data type 10 is active, 20 is complete) and is making monthly payments and return boolean value True if all conditions are met and False if not. Before adding the DBMS output it would compile fine but I get error PLS-00306:wrong number or types of arguments in call"
Was feeling pretty good about solving this on my own but not sure where my mistakes are. Also looking for explanation (commented in code) about exception handlers. Thanks in advance for comments and teaching points!
My code:
CREATE OR REPLACE PROCEDURE DDPAY_SP
(donor_id IN NUMBER, active_pl OUT BOOLEAN)
IS
pay_count NUMBER;
BEGIN
SELECT COUNT(*)
INTO pay_count
FROM dd_pledge
WHERE iddonor = donor_id AND
idstatus = 10 AND
paymonths > 1;
IF pay_count > 1 THEN
active_pl := TRUE;
ELSE active_pl := FALSE;
END IF;
DBMS_OUTPUT.PUT_LINE('Active Pledge and paymonths: ' || active_pl);
/* want to add exception but don't understand how to choose
the handler for blocks of code that are not the Oracle defined
exceptions--Can someone explain better than book I have? I know
code should be:
EXCEPTION
WHEN .....
DBMS_OUTPUT.PUT_LINE(' '); */
END;