Using NOCOPY With Parameters
DECLARE
TYPE emptabtyp IS TABLE OF employees%ROWTYPE;
emp_tab EMPTABTYP := Emptabtyp(NULL); -- initialize
t1 NUMBER;
t2 NUMBER;
t3 NUMBER;
PROCEDURE Get_time
(t OUT NUMBER)
IS
BEGIN
t := dbms_utility.get_time;
END;
PROCEDURE Do_nothing1
(tab IN OUT EMPTABTYP)
IS
BEGIN
NULL;
END;
PROCEDURE Do_nothing2
(tab IN OUT NOCOPY EMPTABTYP)
IS
BEGIN
NULL;
END;
BEGIN
SELECT *
INTO Emp_tab(1)
FROM employees
WHERE employee_id = 100;
emp_tab.Extend(49999,1); -- copy element 1 into 2..50000
Get_time(t1);
Do_nothing1(emp_tab); -- pass IN OUT parameter
Get_time(t2);
Do_nothing2(emp_tab); -- pass IN OUT NOCOPY parameter
Get_time(t3);
dbms_output.Put_line('Call Duration (secs)');
dbms_output.Put_line('--------------------');
dbms_output.Put_line('Just IN OUT: '
||To_char((t2
- t1)
/ 100.0));
dbms_output.Put_line('With NOCOPY: '
||To_char((t3
- t2))
/ 100.0);
END;
/
OUTPUT:-
Call Duration (secs)
--------------------
Just IN OUT: .16
With NOCOPY: 0
PL/SQL procedure successfully completed.
0 comments:
Post a Comment