Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Creating a cursor from a VARCHAR2
Allan Martin wrote:
>
> Hi,
>
> I have a cursor like.....
>
> CURSOR cur_get_info IS
>
> SELECT * FROM .........;
>
> However, I'd like to create the cursor so that instead of typing in the
> SELECT statement, it comes from a string. i.e.
>
> CURSOR cur_get_info IS
>
> [my VARCHAR2];
PL/SQL. User’s Guide and Reference. Release 8.1.6. December 1999. Part No. A77069-01
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 -- open cursor variable
’SELECT ename, sal FROM emp WHERE sal > :s’ USING my_sal;
...
END;
Valery Yourinsky
-- Oracle8 Certified DBA Moscow, RussiaReceived on Wed Sep 19 2001 - 03:57:42 CDT