Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Cursor with dynamic query
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 CorpReceived on Tue Aug 21 2001 - 07:45:57 CDT