Home  >  Article  >  Database  >  存储过程中创建表时 ORA-01031: insufficient privileges的解决

存储过程中创建表时 ORA-01031: insufficient privileges的解决

WBOY
WBOYOriginal
2016-06-07 17:58:011821browse

执行某个存储过程时报错:ORA-01031: insufficient privileges。 调试存储过程,发现在存储过程运行到创建表的这一步时出错,意即没有权限创建表,但实际上执行这个存储过程的用户是有创建表的权限的,在网上得到解决方法,在存储过程中添加如下内容即可:Aut

执行某个存储过程时报错:ORA-01031: insufficient privileges。

调试存储过程,发现在存储过程运行到创建表的这一步时出错,意即没有权限创建表,但实际上执行这个存储过程的用户是有创建表的权限的,在网上得到解决方法,在存储过程中添加如下内容即可:Authid Current_User,修改后的存储过程结构如下:

CREATE OR REPLACE PROCEDURE ITS_KK.pro_create_table_yhx Authid Current_User   
IS 
 
BEGIN 
  execute   immediate  'create   table   aaa(id   number(8),name   varchar2(10)) ';   
 
     
--  COMMIT;  
EXCEPTION  
   WHEN NO_DATA_FOUND  
   THEN 
      NULL;  
   WHEN OTHERS  
   THEN 
      RAISE;  
END pro_create_table_yhx;  

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn