Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic execution of private procedure inside the package

PatzaFeb 16 2010 — edited Feb 16 2010
Hi,

I'm trying to execute the private procedure within the package dynamically (on Oracle 10g). The below is an example of my test.

create or replace package test_patza as
procedure proc_main;
end;
/

create or replace package body test_patza
as
procedure proc_output
as
begin
dbms_output.put_line('Hallo');
end;

procedure proc_main
as
begin
execute immediate 'begin proc_main(); end;';
end;
end;
/

SQL> set serverout on
SQL> exec test_patza.proc_main();
BEGIN test_patza.proc_main(); END;

*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'PROC_MAIN' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ORA-06512: at "SCOTT.test_patza", line 11
ORA-06512: at line 1

I get the above error. Any idea how to achieve this as I need to execute some private procedures based on some conditions.

Appreciate your help.

Thanks in advance.

Regards
Pat
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 16 2010
Added on Feb 16 2010
4 comments
1,036 views