Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the ORA-06512 problem solving?

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to solve the ORA-06512 problem. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

When executing a stored procedure, when there is a dynamic execution of SQL, sometimes an error ORA-06512 is reported.

SQL > select * from dba_role_privs where grantee='dev'; GRANTEE GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE-DEV CONNECT NO YES DEV RESOURCE NO YES-create another test stored procedure: create or replace procedure p_create_table is begin Execute Immediate 'create table test (id int)'; end p_create_table -- then test SQL > exec paired create table; begin paired create table; end; ORA-01031: insufficient permissions ORA-06512: in "DEV.P_CREATE_TABLE", line 3 ORA-06512: in line 1-- you can see that even if you have CONNECT,RESOURCE role, you cannot create a table. Role is not available in stored procedures. -- in this case, we generally need explicit system permissions, such as grant create table to DEV;-- but this approach is too troublesome, and sometimes it may require a lot of authorization to execute stored procedures-- in fact, oracle provides us with a way to use role permissions in stored procedures:-- modify stored procedures, which can use role permissions when joining Authid Current_User. Create or replace procedure p_create_table Authid Current_User is begin Execute Immediate 'create table test (id int)'; end paired create table;-- try again: SQL > exec paired create table; PL/SQL procedure successfully completed-- it's ready to execute. The above is how the editor shares the ORA-06512 problem solving. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report