Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Creating a cursor from a VARCHAR2

Re: Creating a cursor from a VARCHAR2

From: Valery Yourinsky <vsu_at_bill.mts.ru>
Date: Wed, 19 Sep 2001 12:57:42 +0400
Message-ID: <3BA85E06.2A4AC3C3@bill.mts.ru>


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

  1. Native Dynamic SQL Using the OPEN-FOR, FETCH, and CLOSE Statements

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, Russia
Received on Wed Sep 19 2001 - 03:57:42 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US