1Z0-146 · Question #75
You created a procedure as follows: CREATE OR REPLACE PROCEDURE query_prod(twhr VARCHAR2) IS stmt VARCHAR2(100); pname VARCHAR2(20); BEGIN stmt:='SELECT product_name FROM products WHERE…
The correct answer is C. It reduces the chances of SQL injection by using bind arguments. A and D are invalid. B is invalid because you can invoke procedure for example using EXECUTE from sql*plus
Question
You created a procedure as follows:
CREATE OR REPLACE PROCEDURE query_prod(twhr VARCHAR2) IS stmt VARCHAR2(100); pname VARCHAR2(20); BEGIN stmt:='SELECT product_name FROM products WHERE product_id=:2'; EXECUTE IMMEDIATE stmt INTO pname USING twhr; DBMS_OUTPUT.PUT_LINE(pname); END; / View the Exhibit to examine the structure of PRODUCTS table. Which statement is true about the procedure?
Exhibit
Options
- AIt produces an error when invoked.
- BIt can be invoked only from a PL/SQL block.
- CIt reduces the chances of SQL injection by using bind arguments.
- DThe values for bind arguments remain persistent in the session after the execution of the procedure.
How the community answered
(26 responses)- A4% (1)
- B4% (1)
- C81% (21)
- D12% (3)
Explanation
A and D are invalid. B is invalid because you can invoke procedure for example using EXECUTE from sql*plus
Topics
Community Discussion
No community discussion yet for this question.
