Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ref cursor performance

Status
Not open for further replies.

aldovalerio

Programmer
Mar 29, 2001
36
CH
(Oracle 8.1.7) Is there any performance difference between the following two code examples? Are they both actually binding the my_sal variable? Apart from performance, is there any reason to choose one method over the other?

-- Option #1
DECLARE
TYPE EmpCurTyp IS REF CURSOR; -- define weak REF CURSOR type
emp_cv EmpCurTyp; -- declare cursor variable
my_ename VARCHAR2(15);
my_sal NUMBER := 1000;
BEGIN
OPEN emp_cv FOR
'SELECT ename, sal FROM emp WHERE sal > :s'
USING my_sal;
...
END;

-- Option #2
DECLARE
TYPE EmpCurTyp IS REF CURSOR; -- define weak REF CURSOR type
emp_cv EmpCurTyp; -- declare cursor variable
my_ename VARCHAR2(15);
my_sal NUMBER := 1000;
BEGIN
OPEN emp_cv FOR
SELECT ename, sal FROM emp WHERE sal > my_sal;
...
END;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top