L
li2
Unregistered / Unconfirmed
GUEST, unregistred user!
有过程如下:
procedure exec_sql(p_sql in varchar2) as
v_Cursor BINARY_INTEGER;
v_ReturnCode BINARY_INTEGER;
begin
v_Cursor := DBMS_SQL.OPEN_CURSOR;
-- Parse and execute the statement.
DBMS_SQL.PARSE(v_Cursor, p_sql, DBMS_SQL.NATIVE);
v_ReturnCode := DBMS_SQL.EXECUTE(v_Cursor);
-- Close the cursor.
DBMS_SQL.CLOSE_CURSOR(v_Cursor);
end;
调用时用
SQL> begin
2 exec_sql('create table abcd as select sysdate tmp from dual');
3 end;
4 /
begin
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_SYS_SQL", line 491
ORA-06512: at "SYS.DBMS_SQL", line 32
ORA-06512: at "LI2.EXEC_SQL", line 7
ORA-06512: at line 2
但如改为执行 DROP TABLE 就正常,请问是什么原因.
过程创建,执行的用户有DBA权限,
procedure exec_sql(p_sql in varchar2) as
v_Cursor BINARY_INTEGER;
v_ReturnCode BINARY_INTEGER;
begin
v_Cursor := DBMS_SQL.OPEN_CURSOR;
-- Parse and execute the statement.
DBMS_SQL.PARSE(v_Cursor, p_sql, DBMS_SQL.NATIVE);
v_ReturnCode := DBMS_SQL.EXECUTE(v_Cursor);
-- Close the cursor.
DBMS_SQL.CLOSE_CURSOR(v_Cursor);
end;
调用时用
SQL> begin
2 exec_sql('create table abcd as select sysdate tmp from dual');
3 end;
4 /
begin
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_SYS_SQL", line 491
ORA-06512: at "SYS.DBMS_SQL", line 32
ORA-06512: at "LI2.EXEC_SQL", line 7
ORA-06512: at line 2
但如改为执行 DROP TABLE 就正常,请问是什么原因.
过程创建,执行的用户有DBA权限,