0% found this document useful (0 votes)
197 views

f2 SQL

The exception section begins with the EXCEPTION keyword and contains exception handlers that define recovery actions for runtime errors. Each exception handler consists of a WHEN clause specifying an exception name. Exception handling is mandatory in PL/SQL blocks. Predefined exceptions like NO_DATA_FOUND are declared in the declaration section while non-predefined exceptions require declaring the exception name first before handling. The RAISE_APPLICATION_ERROR procedure can be used to return user-defined error messages.

Uploaded by

oc dhogs Tv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
197 views

f2 SQL

The exception section begins with the EXCEPTION keyword and contains exception handlers that define recovery actions for runtime errors. Each exception handler consists of a WHEN clause specifying an exception name. Exception handling is mandatory in PL/SQL blocks. Predefined exceptions like NO_DATA_FOUND are declared in the declaration section while non-predefined exceptions require declaring the exception name first before handling. The RAISE_APPLICATION_ERROR procedure can be used to return user-defined error messages.

Uploaded by

oc dhogs Tv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

The exception section begins with the keyword _______.

Code that defines the recovery actions to be performed when execution-time errors occur. EXCEPTION
HANDLER

Always add ________ whenever there is a possibility of an error occurring.EXCEPTION

Each exception handler is consists of a _____ clause, which specifies an exception name. WHEN

Exception section is mandatory in PL/SQL block. True

The following statements are examples of exception handler.

Entering an expiration date that has passed

Selecting more than one row into a single variablE

Receiving “no rows returned” from a select statement TRUE

A block always terminates when PL/SQL raises an exception. T

The RAISE keyword is used in user-defined exception for error notification. T

Names for predefined exceptions must be declared in the declaration section.T

The PRAGMA clause is used in predefined exception to tell the compiler to associate an exception name
with a specific Oracle error number. T

There are 2 parameters needed in the pragma declaration of an exception. T exception_name and
error_code.

Non-predefined exceptions has a standard Oracle error number (ORA-#####) and error message, but
not a predefined name. T

What is the first step in handing non-predefined exception? Exception name declaration

You can use the ________________ procedure to return user-defined error messages from stored
subprograms. RAISE_APPLICATION_ERROR

Each exception handler is consists of a _____ clause, which specifies an exception name.WHEN

PL/SQL record is a composite data type, you can refer to the whole record by its name and/or to
individual fields by their names. T

The type and the record declared in the outer block are visible within the outer block and the inner
block. T

In explicit cursor operations, the set of rows returned by a multiple-row query is called ________. Active
set
Non-predefined errors are raised explicitly. T37

The NO_DATA_FOUND is an example of:

Predefined exception

– NO_DATA_FOUND

– TOO_MANY_ROWS

– INVALID_CURSOR

– ZERO_DIVIDE

– DUP_VAL_ON_INDEX

The given syntax in declaring a user-define record is incorrect.

TYPE type_name IS RECORD

(field_declaration[,field_declaration]...);

identifier type_name ; T

Given the code below:

DECLARE

CURSOR cur_emps

SELECT employee_id, last_name FROM employees;


BEGIN

FOR v_emp_record IN cur_emps LOOP

EXIT WHEN cur_emps%ROWCOUNT > 5;

DBMS_OUTPUT.PUT_LINE(v_emp_record.employee_id || ' ' || v_emp_record.last_name);

END LOOP;

END;

What step is missing in the given code?

Group of answer choices

CLOSE

Nothing is missing T

Open cursor

FETCH

The given code below declares an explicit cursor. What will cause an error in the code?

DECLARE

CURSOR cur_depts
SELECT * FROM departments WHERE location_id = 1700

ORDER BY department_name;

IS

WHERE location_id = 1700

SELECT * T

ORDER BY department_name;

You might also like