Exception while creating table using EXECUTE IMMEDIATE [message #608367] |
Wed, 19 February 2014 04:00 |
Manoj.Gupta.91
Messages: 239 Registered: March 2008 Location: Delhi
|
Senior Member |
|
|
Hi All,
I'm not able to create a table using execute immediate. I'm working on same schema (owner).
create or replace
PROCEDURE prc_Create_Table
(
ps_in_Table_Name IN VARCHAR2
)
AS
TABLE_ALREADY_EXIST EXCEPTION ;
PRAGMA EXCEPTION_INIT( TABLE_ALREADY_EXIST, -955 ) ;
BEGIN
EXECUTE IMMEDIATE( ' CREATE TABLE MANOJ ( A NUMBER(3) ) ' ) ;
COMMIT ;
EXCEPTION
WHEN TABLE_ALREADY_EXIST THEN
DBMS_OUTPUT.PUT_LINE( 'ERROR 1.......!!' ) ;
DBMS_OUTPUT.PUT_LINE( 'USER = ' || USER || ' ERROR = ' || SQLCODE || SQLERRM ) ;
ROLLBACK ;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE( 'ERROR 2.......!!' ) ;
DBMS_OUTPUT.PUT_LINE( 'USER = ' || USER || ' ERROR = ' || SQLCODE || SQLERRM ) ;
ROLLBACK ;
RAISE ;
END prc_Create_Table ;
BEGIN
prc_Create_Table( 'MANOJ' ) ;
END ;
ERROR :
Error starting at line 20 in command:
BEGIN
prc_Create_Table( 'MANOJ' ) ;
END ;
Error report:
ORA-01031: insufficient privileges
ORA-06512: at "ETM.PRC_CREATE_TABLE", line 25
ORA-06512: at line 2
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label.
Although if I execute below piece of code I can create table.
BEGIN
prc_Create_Table( 'CREATE TABLE MANOJ ( A NUMBER(3) )' ) ;
END ;
Please help me to know what can be the issue.
Thanks & Regards
Manoj
|
|
|
|
|
|