Spikmeister
Programmer
I have two procedures that do identical things, one uses a Standard cursor that it loops through:
The other uses a dynamic one which it fetches into variables and then loops through:
Is there any reason why the procedure with the Standard cursor takes half the time to run through that the one with the dynamic cursor does...???
Code:
CURSOR Cursor_SP IS
SELECT ID, CCT_ID
FROM SP_2
WHERE Inserted_By = 'I';
BEGIN
FOR List_SP IN Cursor_SP LOOP
(Lots of data crunching with other tables)
END LOOP;
END;
The other uses a dynamic one which it fetches into variables and then loops through:
Code:
sql_Statement VARCHAR2 (2000);
strid NUMBER;
strcctid VARCHAR2 (255);
BEGIN
sql_Statement := 'SELECT ID, CCT_ID FROM SP_2 WHERE Inserted_By = ''I'' ';
OPEN Sp_Cursor FOR sql_Statement;
LOOP
FETCH Spares_Cursor
INTO strid,
strcctid;
EXIT WHEN Spares_Cursor%NOTFOUND;
(Same data cruching as other procedure)
END LOOP;
CLOSE Sp_Cursor;
END;
Is there any reason why the procedure with the Standard cursor takes half the time to run through that the one with the dynamic cursor does...???