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: Cursor with dynamic query

Re: Cursor with dynamic query

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 21 Aug 2001 05:45:57 -0700
Message-ID: <9ltl6501te1@drn.newsguy.com>


In article <E9qg7.188$xN2.903275_at_nnrp3.proxad.net>, "Vigi98" says...
>
>Hello all,
>
>I'm used to write "OPEN cursor FOR SELECT tata FROM toto;" where cursor is a
>cursor.
>
>Now, I would like to do the same with a dynamic query, something like
>"OPEN cursor FOR v_query;"
>where v_query is a VARCHAR containing the query.
>
>How to do that ? PL/SQL does not accept this syntax.
>
>Thanks for all your answers.
>
>
>
>
>

That syntax:

begin

    open l_cursor for variable;
end;

is supported in Oracle8i release 1 and up (815 and up)

prior to that, you had to use DBMS_SQL to dynamically process a select.

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Tue Aug 21 2001 - 07:45:57 CDT

Original text of this message

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