In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what is the attention of AUTHID CURRENT_USER". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the attention of AUTHID CURRENT_USER".
1. Create the following test tables and data under An and B users at the same time
A:
Create table tb_test (a varchar2 (50))
Insert into tb_test select 1 from dual
Insert into tb_test select 2 from dual
Insert into tb_test select 3 from dual
Commit
B:
Create table tb_test (a varchar2 (50))
Insert into tb_test select 1 from dual
Insert into tb_test select 2 from dual
Insert into tb_test select 3 from dual
Commit
two。 Create a stored procedure under An and authorize it to B. notice the AUTHID CURRENT_USER here
CREATE OR REPLACE PROCEDURE pd_test
AUTHID CURRENT_USER
IS
BEGIN
UPDATE tb_test SET a = 'abc'
COMMIT
END pd_test
GRANT EXECUTE ON pd_test to B
3. When user B goes down to execute pd_test, it will be found that the tb_ test table data under user B is updated to abc, while the tb_test data table under user An is not updated.
If AUTHID CURRENT_USER is not added, the tb_ test table data under user An is updated to abc, while the tb_test data table under user B is not updated.
Explanation of AUTHID CURRENT_USER:
This is typical, only one stored procedure is created in the database, which can be used by all users, but each user only executes with their own permissions, and many of oracle's own packages are like this.
By default, the stored procedure is called under the identity of the definer definer. If AUTHID CURRENT_USER is added, the caller of the procedure is called with the user rights currently logged in. If the caller of the procedure (rather than the definer) is granted the system permission execute any procedure or authorized by the definer grant execute on of the procedure, the caller can still use the procedure without using this AUTHID CURRENT_ user clause.
In addition, in the stored procedure of Oracle, when it comes to manipulating objects under different schema, you can write the same procedure under different schema, but the problem is that maintenance and synchronization bring trouble.
Add authid current_user to the procedure to indicate that the object operated in procedure is the object currently connected to the user, not the object under the user to which the procedure belongs. So the DML statement in procedure is also operated on the object that currently connects the user.
Thank you for your reading, the above is the content of "what are the points for attention of AUTHID CURRENT_USER". After the study of this article, I believe you have a deeper understanding of what is the point of attention of AUTHID CURRENT_USER, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.