Oracle PL/SQL Programming Quiz

Test your knowledge of Oracle PL/SQL concepts including stored procedures, functions, triggers, exception handling, and table partitioning.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which exception handler must appear LAST in the exception block?

  1. User Defined Exception
  2. Predefined Internal Exception --- NO_DATA_FOUND
  3. Predefined Internal Exception --- VALUE_ERROR
  4. OTHERS Exception
Question 2 Multiple Choice (Multiple Answers)

An application developer needs to write a PL/SQL code, wherein salary raise to be processed for all the employees of grade "C2" and above. As per the Oracle recommended standards, Which PL/SQL objects should be part of his application code? Choose all that apply

  1. Package
  2. Stored Procedure
  3. Cursor
  4. Stored Function
  5. View
  6. Trigger
Question 3 Multiple Choice (Single Answer)

As per the business requirement of a Shipping firm, Inventory Manager should be notified when the Inventory Count for a category "CONTAINER" in the INVENTORY table drops down below 100. However, the user transaction should NOT be aborted, in case the inventory count for a "CONTAINERS" category drops down below 100. The columns of the INVENTORY table, which stores the category name and count are CAT_NAME and TOTAL_COUNT respectively. Specify, which type of TRIGGER an application developer needs to write to address this issue?

  1. Trigger Event - UPDATE of TOTAL_COUNT, Trigger Type - BEFORE ROW, Trigger Restriction - NULL
  2. Trigger Event - UPDATE of TOTAL_COUNT, Trigger Type - BEFORE ROW, Trigger Restriction - WHERE CAT_NAME='CONTAINER' AND NEW.TOTAL_COUNT<100
  3. Trigger Event - UPDATE of TOTAL_COUNT, Trigger Type - BEFORE STATEMENT, Trigger Restriction - NULL
  4. Trigger Event - UPDATE of TOTAL_COUNT, Trigger Type - BEFORE STATEMENT, Trigger Restriction - WHERE CAT_NAME='CONTAINER' AND NEW.TOTAL_COUNT<100
  5. Trigger Event - UPDATE of TOTAL_COUNT, Trigger Type - AFTER ROW, Trigger Restriction - NULL
  6. Trigger Event - UPDATE of TOTAL_COUNT, Trigger Type - AFTER ROW, Trigger Restriction - WHERE CAT_NAME='CONTAINER' AND NEW.TOTAL_COUNT<100
Question 4 Multiple Choice (Single Answer)

What is true about exception propagation?

  1. The current block is always searched first for a handler
  2. If the exception handler is NOT found in the current block, enclosing block if any is searched for the exception handler.
  3. If the exception handler is found, then it's executed. Control is passed to the enclosing block if one exists OR to the calling environment if there is no enclosing block.
  4. If the exception handler is NOT found, then exception is returned back to the calling environment
  5. All of above
Question 5 Multiple Choice (Multiple Answers)

Identify the BOOLEAN variables in the context of the TRIGGER. Choose all that apply.

  1. UPDATING
  2. CREATING
  3. DELETING
  4. SELECTING
  5. INSERTING
  6. ALTERING
Question 6 True/False

SQLCODE and SQLERRM cannot be used within a SQL statement directly. Instead, you must assign their values to local variables, then use the variables in the SQL statement

  1. True
  2. False
Question 7 Multiple Choice (Single Answer)

Stored Procedures and stored function are the same, except

  1. Stored function returns a value and a stored procedure does not.
  2. Stored procedure returns a value and a stored function does not.
  3. Stored function returns a value and a stored procedure may OR may not.
  4. Stored procedure returns a value and a stored function may OR may not.
Question 8 Multiple Choice (Single Answer)

What is meant by cascading in the context of the database triggers?

  1. When a trigger fires, a SQL statement within its trigger action potentially can fire other triggers
  2. When a trigger fires, a SQL statement within its trigger action potentially can update other tables
  3. When a trigger fires, a SQL statement within its trigger action potentially can fire other stored procedures
  4. When a trigger fires, a SQL statement within its trigger action potentially can drop other tables
Question 9 True/False

A stored procedure must have at least one argument

  1. True
  2. False
Question 10 Multiple Choice (Single Answer)

What is the default mode for arguments in stored procedure?

  1. IN
  2. OUT
  3. IN OUT
  4. OUT IN
Question 11 True/False

Primary difference between a stored procedure and stored function is that, function must return a value through an explicit return statement wherein stored procedure does NOT.

  1. True
  2. False
Question 12 True/False

DDL statements are allowed in the database triggers

  1. True
  2. False
Question 13 Multiple Choice (Single Answer)

An application developer has written a database package for an Order Entry application using SQL Plus editor. While compiling the package, he receives errors. What will be the next step to troubleshoot the error?

  1. Execute the command FIX ERROR
  2. Execute the command SHOW ERROR
  3. Execute the command TROUBLESHOOT ERROR
  4. Execute the command INVESTIGATE ERROR
  5. Execute the command ANALYZE ERROR
Question 14 True/False

RAISE_APPLICATION_ERROR procedure can be used ONLY in database triggers to handle user defined exceptions

  1. True
  2. False
Question 15 Multiple Choice (Multiple Answers)

A database TRIGGER is made up of ... Choose all that apply

  1. TRIGGER SPECIFICATION
  2. TRIGGER EVENT
  3. TRIGGER TYPE
  4. TRIGGER BODY
  5. TRIGGER RESTRICTION
  6. TRIGGER ACTION
Question 16 True/False

A database TRIGGER in DISABLED state won't execute the TRIGGER ACTION

  1. True
  2. False
Question 17 Multiple Choice (Single Answer)

An application developer has written an AFTER STATEMENT trigger for UPDATE event on the ORDERS table of ORDER ENTRY application. The trigger saves the details of the user performing the update, system date, number of records updated to the AUDIT table. User, ERIC accesses ORDER ENTRY application and submits an UPDATE on ORDERS table through a batch job. However, the update statement affects ZERO records from ORDERS table. What is true in the context of the database trigger being written?

  1. Database Trigger will NOT fire at all as number of records updated are ZERO. However, batch job will run through successfully.
  2. Database Trigger will fire only ONCE and will save details viz. "ERIC", "SYSDATE" and "0" to the AUDIT table. The batch job will run through successfully.
  3. Database Trigger will return an ERROR and abort the batch job
  4. Database Trigger will return an ERROR. However, batch job will run through successfully
Question 18 Multiple Choice (Multiple Answers)

Identify 3 parent partitioning schemes.

  1. RANGE
  2. INTERVAL
  3. LIST
  4. HASH
  5. VIRTUAL
  6. REFERENCE
Question 19 Multiple Choice (Single Answer)

An application architect is considering to redesign ORDERS table of an ORDER ENTRY application using partitioning. He's NOT very sure about the usage of ORDERS table from end user perspective. However, he wants to distribute the data equally across all table partitions. Which partitioning scheme is his obvious choice?

  1. RANGE
  2. HASH
  3. LIST
  4. INTERVAL
Question 20 Multiple Choice (Single Answer)

Which of the following is not a string function?

  1. concat
  2. initcap
  3. round
  4. length