In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to understand the definer permissions and user permissions of the database". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
I ran the following statement in HR mode (no error occurred):
CREATE TABLE plch_parts (partnum NUMBER, partname VARCHAR2 (50)) / BEGIN INSERT INTO plch_parts VALUES (123,' Steering Wheel'); INSERT INTO plch_parts VALUES (456,' Brake Pedal'); COMMIT;END;/CREATE OR REPLACE TYPE plch_numbers_t IS TABLE OF NUMBER/CREATE OR REPLACE FUNCTION plch_func RETURN plch_numbers_t AUTHID CURRENT_USERIS l_numbers plch_numbers_t;BEGIN SELECT partnum BULK COLLECT INTO l_numbers FROM plch_parts RETURN lumped numbers / GRANT SELECT ON plch_func_v TO scott/GRANT EXECUTE ON plch_func TO scott/ / create create number / GRANT SELECT ON plch_func_v TO scott/GRANT EXECUTE ON plch_func TO scott/
Then I connect to the SCOTT mode and execute the following statement:
CREATE TABLE plch_parts (partnum NUMBER, partname VARCHAR2 (50)) / BEGIN INSERT INTO plch_parts VALUES (100,' Tire'); INSERT INTO plch_parts VALUES (101,' Battery'); COMMIT;END;/
Which options show the output on the screen after the execution of the following statement blocks?
BEGIN DBMS_OUTPUT.put_line ('Two Cursor For Loops....'); FOR rec IN (SELECT p.partname FROM TABLE (hr.plch_func) v, plch_parts p WHERE v.column_value = p.partnum ORDER BY p.partnum) LOOP DBMS_OUTPUT.put_line (rec.partname); END LOOP FOR rec IN (SELECT p.partname FROM hr.plch_func_v v, plch_parts p WHERE v.partnum = p.partnum ORDER BY p.partnum) LOOP DBMS_OUTPUT.put_line (rec.partname); END LOOP;END;/
(A)
Two Cursor For Loops....Steering WheelBrake Pedal
(B)
An unhandled exception:PLS-00158: AUTHID CURRENT_USER subprograms not allowed in views
(C)
Two Cursor For Loops....TireBattery
(D)
Two Cursor For Loops....TireBatterySteering WheelBrake Pedal
(E)
Two Cursor For Loops....TireBatteryTireBattery
Measured answer C
SQL > BEGIN 2 DBMS_OUTPUT.put_line ('Two Cursor For Loops....'); 3 4 FOR rec IN (SELECT p.partname 5 FROM TABLE (yoga.plch_func) v, plch_parts p 6 WHERE v.column_value = p.partnum 7 ORDER BY p.partnum) 8 LOOP 9 DBMS_OUTPUT.put_line (rec.partname); 10 END LOOP 11 12 FOR rec IN (SELECT p.partname 13 FROM yoga.plch_func_v v, plch_parts p 14 WHERE v.partnum = p.partnum 15 ORDER BY p.partnum) 16 LOOP 17 DBMS_OUTPUT.put_line (rec.partname); 18 END LOOP; 19 END; 20 / Two Cursor For Loops....TireBatteryPL/SQL procedure successfully completedSQL >
Answer C.
A function defined as caller permission (AUTHID CURRENT_USER), if it is called in a VIEW or trigger, operates according to the definer's permission, so what you see through VIEW will be OWNER data, not the current user's data.
This is the end of the content of "how to understand the definer permissions and user permissions of the database". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.