Friday, December 17, 2010

ORA-24338: statement handle not executed

This happens when you try to read a cursor after fetching data from it. Try to read the cursor before you fetch data from it



PROCEDURE GetAffiliateCouriers(paffiliate_id number, io_cursor IN OUT appCursor)

IS

vcursor appCursor; tcursor appCursor; retCursor appCursor;

affiliate_id INTEGER; t_allow_courier_selection INTEGER;

v_row AFFILIATE%ROWTYPE; t_row AFFILIATE_COURIER%ROWTYPE;

BEGIN

vcursor := NULL;

tcursor := NULL;

affiliate_id := paffiliate_id;

LOOP

OPEN vcursor FOR SELECT * FROM affiliate WHERE id = affiliate_id AND allowcourierselection = 1;

FETCH vcursor INTO v_row;

IF (vcursor%FOUND) THEN

OPEN tcursor FOR SELECT * FROM affiliate_courier WHERE affiliate_courier.fk_affiliate_id = affiliate_id;

FETCH tcursor INTO t_row;

IF (tcursor%FOUND) THEN

OPEN retCursor FOR SELECT * FROM affiliate_courier WHERE affiliate_courier.fk_affiliate_id = affiliate_id;

io_cursor := retCursor;

RETURN;

END IF;

END IF;

SELECT fk_parent_id INTO affiliate_id FROM affiliate WHERE affiliate.id = affiliate_id;

EXIT WHEN affiliate_id IS NULL;

END LOOP;

io_cursor := retCursor;

END GetAffiliateCouriers;

No comments:

Post a Comment