continuous....Write the code solution using an explicit cursor with a simple Loop. Make sure to use your own variables. (10 marks)
DECLARE TYPE ref_cursor IS REF CURSOR;
cur REF_CURSOR;
d_item_no items.item_no%TYPE;
d_item_descr items.item_descr%TYPE;
BEGIN OPEN cur FOR 'SELECT i.item_no, i.item_descr FROM ITEMS i WHERE i.item_no in (1,2,3)';
LOOP
FETCH cur INTO d_item_no, d_item_descr;
EXIT WHEN cur%NOTFOUND;
dbms_output.put_line( d_item_no||' '||d_item_descr );
END LOOP;
CLOSE cur;
END;
Comments
Leave a comment