Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Cannot pass a view name to a stored procedure as a parameter
"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 addressReceived on Thu Nov 15 2001 - 03:21:22 CST
![]() |
![]() |