Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- with schema1
- create or replace procedure schema1.EXECUTE_RAW_SQL ( statement in varchar2 )
- is begin
- execute immediate statement;
- exception when others then
- raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
- end;
- -- with dba
- create user schema2 identified by schema2;
- grant connect to schema2;
- grant create session to schema2;
- grant execute on schema1.EXECUTE_RAW_SQL to schema2;
- -- with schema2
- execute schema1.EXECUTE_RAW_SQL('create table blah ( id number(10), name varchar2(255) )');
- -- Error starting at line : 1 in command -
- -- BEGIN schema1.EXECUTE_RAW_SQL('create table blah ( id number(10), name varchar2(255) )'); END;
- -- Error report -
- -- ORA-20001: An error was encountered - -1031 -ERROR- ORA-01031: insufficient privileges
- -- ORA-06512: at "schema1.EXECUTE_RAW_SQL", line 5
- -- ORA-06512: at line 1
- -- with dba
- grant create table to schema1;
- -- with schema2
- execute schema1.EXECUTE_RAW_SQL('create table blah ( id number(10), name varchar2(255) )');
- -- with schema1
- describe blah;
- -- Name Null? Type
- -- ---- ----- -------------
- -- ID NUMBER(10)
- -- NAME VARCHAR2(255)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement