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: How can I dynamically execute a procedure name?

Re: How can I dynamically execute a procedure name?

From: Thomas Gaines <Thomas.Gaines_at_noaa.gov>
Date: Thu, 15 Aug 2002 09:23:26 -0600
Message-ID: <3D5BC76E.5B5CC95D@noaa.gov>


Marcie -

It's not that tough. If you're looking for an example, use this one:

drop procedure dummy1;
create procedure dummy1 as
  var1 number;
begin
  dbms_output.put_line('inside of procedure dummy1');   select count(*) into var1 from user_objects;   dbms_output.put_line('the number of user objects is ' || var1); end;
/

drop procedure dummy2;
create procedure dummy2 as
  stmt varchar2(100);
begin
  dbms_output.put_line('inside of procedure dummy2');   stmt := 'begin dummy1; end;';
  execute immediate stmt;
end;
/

set serverout on size 100000
execute dummy2;

This worked just fine for me. What happens when you run the code above??

It would be helpful out here in newsgroup-land if you defined precisely what you mean when you say you "can't get it to execute a procedure."

Tom

marcie wrote:

> Brian,
>
> I've tried looking into execute immediately but can't get it to
> execute a procedure. The only examples I've been able to find execute
> a select, insert etc. I haven't been able to find an example or use a
> procedure with execute immediately.
>
> Any ideas?
> Thanks
Received on Thu Aug 15 2002 - 10:23:26 CDT

Original text of this message

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