Re: ORA-00911 in Dynamic SQL

From: AnaCDent <anacedent_at_hotmail.com>
Date: Thu, 08 Apr 2004 17:12:34 -0700
Message-ID: <PTldc.16281$Vo.16168_at_fed1read03>


traceable1 wrote:
> I am trying to create a stored procedure with dynamic sql referencing
> the V$SESSION table (view). I need to use this dynamically, because
> the procedure will not compile if the user does not have access to
> this table. The $ is what's causing the trouble:
>
> declare v_sql varchar2(4000);
> begin
> v_sql := 'select * from v$session;';
> execute immediate (v_sql);
> end;
> /
>
>
> I've tried \ and double quotes, but they don't work. Any clues?
>
> THANK YOU!!!!
>
> trace

declare v_sql varchar2(4000);
begin
v_sql := 'select * from v$session';
execute immediate v_sql;
end;
/ Received on Fri Apr 09 2004 - 02:12:34 CEST

Original text of this message