| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Cursors with multiple selects
On Tue, 9 Oct 2001 10:05:13 +0200, "Vigi98" <vigi98_at_my-deja.com> wrote:
> Hi all,
>
> I'm wondering if it is possible to fill in a cursor in another way that
> "OPEN CURSOR FOR SELECT...".
>
> Eg, is it possible to fiil in it with several select ?
>
> --
>
> ====================================================
> Anselme HUBER CAP GEMINI Telecom
> Phone : +33 (0)4 76 52 63 09 GSM : +33 (0)6 83 87 39
> 07
> FAX : +33 (0)4 76 52 62 01 Mailto:
> anselme.huber_at_cgey.com
>
>
>
Sure, with Ora 8.1.x you can open a cursor with a "dynamic sql string". Check the documentation: PL/SQL => Native Dynamic SQL. The clue is to declare a "weak" REF CURSOR TYPE and then to declare the cursor by using that type:
DECLARE TYPE weak_cursor_type IS REF CURSOR;
weak_cursor weak_cursor_type;
l_sql VARCHAR2(2000);
BEGIN l_sql := 'SELECT bla FROM blub';
OPEN weak_cursor FOR l_sql;
..
END;
/
Received on Tue Oct 09 2001 - 08:14:17 CDT
![]() |
![]() |