I'm trying to figure out regression testing and the test manager. I'm really a newbie to PLSQL.
So, my objective is to make the cursor :x a global variable which can be referred to in other test scripts in that test manager group, then i can loop over that cursor...
Only I get ORA-=01001: invalid cursor, ORA-06512 at line 9 (that is, FETCH c INTO v_code, v_desc
. Seems I did something wrong... i can see that in the Run Log under Input Vvariable values, x = "", so i don't know sure what to do.
So, my objective is to make the cursor :x a global variable which can be referred to in other test scripts in that test manager group, then i can loop over that cursor...
SQL:
-- Created on 6/23/2025 by ZITOT
declare
-- Local variables here
c SYS_REFCURSOR;
v_code varchar2(6);
v_desc varchar2(30);
begin
-- Test statements here
OPEN c FOR
select term_code,
term_desc
from term
where term_code > '202400'
and term_code < '202600';
:x := c;
LOOP
FETCH :x INTO v_code, v_desc;
EXIT WHEN :x%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Code: ' || v_code || ', Desc: ' || v_desc);
END LOOP;
end;
SQL:
-- Script #2
-- Now: Use the cursor
DECLARE
v_code varchar2(6);
v_desc varchar2(30);
c SYS_REFCURSOR;
BEGIN
c := :x;
LOOP
FETCH c INTO v_code, v_desc;
EXIT WHEN c%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Code: ' || v_code || ', Desc: ' || v_desc);
END LOOP;
CLOSE c;
--FETCH :x INTO v_code, v_desc;
--EXIT WHEN :x%NOTFOUND;
--DBMS_OUTPUT.PUT_LINE('Code: ' || v_code || ', Desc: ' || v_desc);
--END LOOP;
--CLOSE :x;
END;
//
Only I get ORA-=01001: invalid cursor, ORA-06512 at line 9 (that is, FETCH c INTO v_code, v_desc
