I am using oracle 11g . I am trying to run a procedure inside a package by using the command
execute package.procedure
but I keep getting the exception
ERROR at line 1:
ORA-06550: line 1, column 12:
PLS-00302: component 'package' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
The package and package body i created is the following. What i am actually trying to do here is to create a package which is used to create tables each time its executed. so i wrote the following script.
—–Package
create or replace package pack1 as
end pack1 ;
/
——Package Body
create or replace package body pack1 as
procedure proc1
is
begin
execute immediate 'create table bcd(bc date)';
end ;
procedure proc2
is
begin
execute immediate 'create table bcde(bc number(12,0)) as select country_id from countries';
end ;
end pack1;
/
but when i ran
execute pack1.proc2 ;
It gave me the above exception.
Can someone help me with what is wrong ?
Thanks a ton in advance
Procedures and functions in a package are private by default. To make them public you have to declare them in the package specification:
Creating tables on the fly doesn’t sounds like a good idea though.