Get the App
SLTechnology News&Howtos  ›  Database  › 

How to understand the definer permissions and user permissions of the database

Shulou Source: shulou.com Published: 2022-05-31 15:24:43 09月23日 Update

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!

Tags: Permissions data statements users databases content more patterns knowledge answers output practical learned next functions dilemmas reality screens situations articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Linux OPPO Reno macOS Xiaomi