NiC IT Academy

PLSQL Quiz – 06

By Mr.Chandra

Loading

1) Which of the following is used to check if a cursor has fetched all rows in PL/SQL?

2) In which scenario would you use a PL/SQL package?

3) What is the purpose of the PRAGMA EXCEPTION_INIT directive in PL/SQL?

4) If you want to process each row returned by a query in a PL/SQL block, which structure should you use?

5) Which clause in a PL/SQL block allows you to continue processing after an error is encountered?

6) Which of the following is the correct way to call a function in PL/SQL within a SQL statement?

7) When using FORALL in PL/SQL, what type of collection must be used?

8) If a PL/SQL block does not have an EXCEPTION section and an error occurs, what happens?

9) Which of the following can be used to optimize performance when inserting large amounts of data using PL/SQL?

10) In PL/SQL, which built-in package is commonly used for outputting messages during debugging?

11) You need to update several rows in a table with data from another table using PL/SQL. Which method is the most efficient?

12) Given the following procedure: sql Copy code CREATE OR REPLACE PROCEDURE calculate_bonus(emp_id IN NUMBER, bonus OUT NUMBER) IS BEGIN SELECT salary * 0.1 INTO bonus FROM employees WHERE employee_id = emp_id; EXCEPTION WHEN NO_DATA_FOUND THEN bonus := 0; END; What happens if the employee_id does not exist in the employees table?

13) What is the result of the following PL/SQL code if the employees table is empty? sql Copy code DECLARE TYPE emp_table IS TABLE OF employees%ROWTYPE; emp_list emp_table; BEGIN SELECT * BULK COLLECT INTO emp_list FROM employees; DBMS_OUTPUT.PUT_LINE(emp_list.COUNT); END;

14) Which of the following is true about the INSTEAD OF trigger in PL/SQL?

15) Given a table orders with columns order_id, customer_id, and order_date, what is the result of the following PL/SQL block? sql Copy code DECLARE v_count NUMBER; BEGIN SELECT COUNT(*) INTO v_count FROM orders WHERE order_date > SYSDATE; DBMS_OUTPUT.PUT_LINE('Count: ' || v_count); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('An error occurred.'); END;

16) Which of the following PL/SQL structures would be the best to use when executing a series of similar DML statements with different values in a performance-sensitive application?

17) In a scenario where you need to create a complex report using multiple PL/SQL procedures and functions, which feature would be most useful to improve code maintainability?

18) Consider the following cursor declaration: sql Copy code CURSOR emp_cursor IS SELECT employee_id, salary FROM employees WHERE department_id = 10 FOR UPDATE; What is the effect of using the FOR UPDATE clause?

19) When is it necessary to use the PRAGMA AUTONOMOUS_TRANSACTION directive in PL/SQL?

20) Which collection method can be used to determine if a nested table is empty in PL/SQL?

Login with your email & password

Sign up with your email & password

Signup/Registration Form