I am trying to use the following procedure for dropping users from the database, the procedure compiles ok but does not seem to work.
create or replace Procedure test (username IN varchar2)
is
The original procedure gave an "insufficient privileges" error when I tried to run it under the SYSTEM user. However, when I added an "authid current_user", it worked:
create or replace Procedure test (username IN varchar2) authid current_user
is
cursor_id integer;
sql_string varchar2(200);
BEGIN
cursor_id := DBMS_SQL.OPEN_CURSOR;
sql_string := 'drop user ' || username || ' cascade' ;
dbms_output.put_line(sql_string);
DBMS_SQL.PARSE(cursor_id, sql_string , DBMS_SQL.NATIVE);
dbms_output.put_line('user '|| username || 'dropped');
DBMS_SQL.CLOSE_CURSOR (cursor_id);
END ;
You may not have seen the error message if you hadn't done a "set serveroutput on" when it was run.
Bookmarks