Dear DBA Gurus,
I am able to execute the below code as an anonymous Pl/Sql block but when I
incorporate it in a stored procedure the procedure gets created but I am
getting the below errors while executing the procedure as system user:
Anonymous Pl/Sql block
Declare
name varchar2(4):='test';
BEGIN
EXECUTE IMMEDIATE 'create user ' ||name||' '||'identified by '||name||'
'||
'default tablespace users temporary tablespace temp';
EXECUTE IMMEDIATE 'grant connect, resource to ' ||name;
EXECUTE IMMEDIATE 'create table '||name||'.aaa(a number)';
EXECUTE IMMEDIATE 'create table '||name||'.bbb(b number)';
END;
Stored Procedure
create or replace procedure create_user (name IN VARCHAR2)
IS
BEGIN
EXECUTE IMMEDIATE 'create user ' ||name||' '||'identified by '||name||'
'||
'default tablespace users temporary tablespace temp';
EXECUTE IMMEDIATE 'grant connect, resource to ' ||name;
EXECUTE IMMEDIATE 'create table '||name||'.aaa(a number)';
EXECUTE IMMEDIATE 'create table '||name||'.bbb(b number)';
END;
/
Procedure Created.
Errors while executing the procedure
exec create_user('test');
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYSTEM.CREATE_USER", line 4
ORA-06512: at line 1
What might be the reason for the errors? Can anyone help me?
TIA and Regards,
Ranganath
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Ranganath K
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).