Re: cursor with dynamic where clause

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Fri, 17 May 2002 19:03:34 +0200
Message-ID: <4udaeu882qesbv2p67o3n4adh5ij6qeqv5_at_4ax.com>


On Fri, 17 May 2002 14:56:07 +0200, "Aurelio Martin" <amartin_at_traza-si.com> wrote:

>
>"Stefan Röhle" <roehle_at_uni-mainz.de> escribió en el mensaje
>news:3CE4E742.214929F4_at_uni-mainz.de...
>> Hi,
>>
>> I'd like to use a a cursor with a dynamic where clause, for example like
>> this:
>>
>> ------------------
>> PROCEDURE diff_test (where_clause in varchar2) IS
>>
>> cursor cur_test is
>> select * from vw_data
>> where where_clause;
>>
>> BEGIN
>> [do something]
>> END;
>> ------------------
>> Since this doesn't work this naive way - how can I do it?
>>
>> Stefan
>
>It looks like you need dynamic SQL. Look for package dbms_sql.
>
>Aurelio
>
>
Or Native Dynamic SQL (Open <cursorvariable> for <sqlstring>) in 8i and higher.

Hth

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Fri May 17 2002 - 19:03:34 CEST

Original text of this message