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: Vigi98 <vigi98_at_dejanews.com>
Date: Tue, 21 Aug 2001 12:05:50 GMT
Message-ID: <y8sg7.229$Wc3.1034431@nnrp3.proxad.net>


Seems to be quite complex, but if this is the solution, I will use it. Thanks a lot for your answer.

Ha au fait, on dirait que vous êtes français. Moi aussi, ça pourrait aider :-)

"Yann CAUCHARD" <yann.cauchard_at_spcconsultants.com> wrote in message news:9ltbmu$a4n$1_at_news6.isdnet.net...
> Something like :
>
> temp_cur integer;
> temp_count number;
> Status integer;
> num_recs integer;
>
> begin
> temp_cur := DBMS_SQL.OPEN_CURSOR;
> DBMS_SQL.PARSE(temp_cur,'select count(distinct '||col_name||') from
> '||tab_name
> ||' where '||where_qry,
> DBMS_SQL.NATIVE);
> DBMS_SQL.DEFINE_COLUMN (Temp_Cur, 1, Temp_Count);
> Status := DBMS_SQL.EXECUTE (Temp_Cur);
> IF (DBMS_SQL.FETCH_ROWS (Temp_Cur) > 0) THEN
> DBMS_SQL.COLUMN_VALUE (Temp_Cur, 1, Temp_Count);
> num_recs := Temp_Count;
> END IF;
> DBMS_SQL.CLOSE_CURSOR (Temp_Cur);
> .....
>
> Yann
>
> Vigi98 a écrit dans le message ...
> >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.
> >
> >
> >
> >
> >
>
>
Received on Tue Aug 21 2001 - 07:05:50 CDT

Original text of this message

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