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: Cannot pass a view name to a stored procedure as a parameter

Re: Cannot pass a view name to a stored procedure as a parameter

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 15 Nov 2001 10:21:22 +0100
Message-ID: <tv7m3d24phed46@corp.supernews.com>

"Arijit Mukherjee" <arijit_at_lucent.com> wrote in message news:3BF36EBA.5639BBA7_at_lucent.com...
> Hi,
> I am using Oracle 8 and need to pass a view name to a stored
> procedure. I tried passing the name as varchar2. However, when I try to
> use this string inside a query (be it inside a cursor or inside the
> executable block inside the stored procedure), I get a compilation error
> - saying that this varchar2 variable is undefined.
> Is there any way I can do this?
> Any help is highly appreciated,
> Regards,
> Arijit

You'll need to use dynamic sql in pl/sql if you want to have the view name variable.
You can do this by using the dbms_sql package (7.3 and 8.0) or OPEN <cursor var> FOR stringvar and execute immediate stringvar in 8i and higher.

Hth

--
Sybrand Bakker
Senior Oracle DBA

to reply remove '-verwijderdit' from my e-mail address
Received on Thu Nov 15 2001 - 03:21:22 CST

Original text of this message

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