PL/SQL Interview Questions – Set 05

What is the difference between syntax error and runtime error?

A syntax error can be easily detected by a PL/SQL compiler. For example: incorrect spelling etc. while, a runtime error is handled with the help of exception-handling section in a PL/SQL block. For example: SELECT INTO statement, which does not return any rows.

How to write a single statement that concatenates the words ?Hello? and ?World? and assign it in a variable named Greeting?

Greeting := ‘Hello’ || ‘World’;

What are the different schemas objects that can be created using PL/SQL?

  • Stored procedures and functions
  • Packages
  • Triggers
  • Cursors

What is cursor and why it is required?

A cursor is a temporary work area created in a system memory when an SQL statement is executed.

A cursor contains information on a select statement and the row of data accessed by it. This temporary work area stores the data retrieved from the database and manipulate this data. A cursor can hold more than one row, but can process only one row at a time. Cursor are required to process rows individually for queries.

How do you declare a user-defined exception?

You can declare the User defined exceptions under the DECLARE section, with the keyword EXCEPTION.

Syntax:

EXCEPTION;

What do you understand by PL/SQL packages?

A PL/SQL package can be specified as a file that groups functions, cursors, stored procedures, and variables in one place.