11g: Program with PL/SQL Quiz Questions and Answers

In the SQL Cursor, which attribute is TRUE when a cursor has some remaining rows to fetch, and FALSE when a cursor has no rows left to fetch?

Answer :
  • %FOUND

Explanation :

The %FOUND is a cursor attribute. The return value will be TRUE if the DML statements have an affect on atleast one row and the SELECT...INTO statement also returns atleast one row. The return value will be FALSE if the DML statements do not affect any row and the SELECT...INTO statement does not return any row.

In which mode parameter lets you pass values to the subprogram being called? It cannot be assigned a value.

Answer :
  • Using the IN mode

Explanation :

IN parameter is which helps us to pass a value to the subprogram. This parameter is a read-only parameter and it acts like a constant in a subprogram. No value can be assigned to it.

PL/SQL provides a feature to handle the Exceptions which occur in a PL/SQL Block known as exception Handling.

Answer :
  • TRUE

Explanation :

An exception handling block is used so that we can avoid the errors in the program. The exception message consists of 1. Type of exception 2. An error code 3. A message

Which collection types is also known as index-by tables, lets you look up elements using arbitrary numbers and strings for subscript values?

Answer :
  • Associative arrays

Explanation :

The associative arrays helps us to look up to the elements using arbitary numbers and strings for subscript values. They are similar to hash tables.

Which of the following is used to input the entry and give the result in a variable in a procedure?

Answer :
  • In and out

Explanation :

Create procedure dept count proc(in dept name varchar(20), out d count integer). Here in and out refers to input and result of procedure.

The CLOSE statement enables a cursor variable and makes the associated result set undefined.

Answer :
  • No

Explanation :

he above statement is false. The correct statement is: The CLOSE statement disables the cursor, and the result set becomes undefined.

Which of the following is the correct format for if statement?

Answer :
  • If boolean expression then statement or compound statement elseif boolean expression then statement or compound statement else statement or compound statement end if

Explanation :

The conditional statements supported by SQL include if-then-else statements by using this syntax. elif and elsif are not allowed.

Which statement associates a cursor variable with a multi-row query, executes the query, and identifies the result set?

Answer :
  • OPEN-FOR

Explanation :

The query associated with a cursor variable executes using the OPEN-FOR statement. It helps in identifying the result set.