PL/SQL Interview Questions and Answers Part 4

21. What is the purpose of WHEN clause in trigger?

Answer:

A WHEN clause specifies the condition that must be true for the trigger to be triggered.

22. What are the different schema objects that can be created using PL/SQL?

Answer:

  • Packages
  • Triggers
  • Cursors
  • Stored procedures
  • Functions

23. Explain the purpose of cursor attribute SQL%ROWCOUNT, SQL%FOUND and SQL%NOTFOUND?

Answer:

SQL%ROWCOUNT: It returns the number of rows that are processed by a SQL statement.

SQL%NOTFOUND: It returns the Boolean value TRUE if at least one row was processed.

SQL%NOTFOUND: It returns the Boolean value TRUE if no rows were processed.

24. Write a command to delete a package.

Answer:

DROP PACKAGE

25. What are the three basic sections of a PL/SQL block?

Answer:

  • Declaration section
  • Execution section
  • Exception section

26. What is a MERGE statement?

Answer:

The MERGE statement inserts or updates rows in one table, using data from another table. It is useful in data warehousing applications.