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: Pass a query into a stored proc?

Re: Pass a query into a stored proc?

From: <gmei_at_my-deja.com>
Date: Sat, 26 Feb 2000 19:08:02 GMT
Message-ID: <8998ag$s1q$1@nnrp1.deja.com>


In article <38B6B595.B4E3CDDB_at_fast.no>,   kev <kevin.porter_at_fast.no> wrote:
> Hi,
>
> I want to be able to pass a select query into a procedure, open a cursor
> for that query then return the cursor.
>
> So far, I have managed to make a function that opens a cursor for a
> hardcoded query, but is it possible to pass in a varchar2 which holds
> the query to execute? How's it done?
>
> Here's the simple proc I have at the moment:
>
> create or replace package types
> as
> type cursorType is ref cursor;
> end;
> /
>
> create or replace procedure retcurs_proc
> (mycurs out types.cursorType)
> is
> begin
> open mycurs for select * from emp;
>
> end retcurs_proc;
> /
>
> How could I change the above proc to be able to pass in a query?
>
> thanks,
>
> - Kev
>
>

I am not 100% sure, but you may want to look at dynamic SQL

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sat Feb 26 2000 - 13:08:02 CST

Original text of this message

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