FA2 - Sheet1 (1) Flashcards
Start with the _____ keyword to define a user-defined record structure.
TYPE
Given:
DECLARE v_emp_record \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_;
What is missing in the declaration section if we want to declare v_emp_record as type record of EMPLOYEES table? __________
EMPLOYEES%ROWTYPE
The OPEN will populate the cursor’s active set with the result of the SELECT statement in the cursor’s definition?
True
False
True
The FETCH statement positions the cursor pointer at the first row.
Group of answer choices
True
False
False
What is missing in the given exception syntax? ____
EXCEPTION
WHEN exception1 [OR exception2 . . .] statement1; statement2;
THEN
Always add ________ whenever there is a possibility of an error occurring.
EXCEPTION HANDLERS
Handle named exceptions whenever possible, instead of using ______ in exception handlers.
OTHERS
Error in PL/SQL is known as ____________.
EXCEPTION
Each ________ is consists of a WHEN clause, which specifies an exception name.
EXCEPTION HANDLER
When an exception is raised, control immediately shifts to the exception section and the appropriate handler in the exception section is executed.
True
False
t
The term TRAP in exceptions is the same as handling any error by including corresponding exception handler.
Group of answer choices
True
False
True
A block always terminates when PL/SQL raises an exception.
Group of answer choices
True
False
True
An exception handler for a particular exception must contain only one statement.
Group of answer choices
True
False
False
The RAISE keyword is used in user-defined exception for error notification.
Group of answer choices
True
False
True
The PRAGMA clause is used in predefined exception to tell the compiler to associate an exception name with a specific Oracle error number.
Group of answer choices
True
False
False
User-defined exceptions are declared within the declarative section and are raised explicitly.
Group of answer choices
True
False
t
Non-predefined errors are raised explicitly.
Group of answer choices
True
False
The RAISE statement can be used to raise either user-defined or non-predefined exception.
Group of answer choices
True
False
The user-defined exceptions are declared within the declarative section and are raised implicitly.
Group of answer choices
True
False
False
What is the first step in handing non-predefined exception?
Group of answer choices
Exception name declaration
Pragma declaration
Exception name declaration
The RAISE statement can be used to raise either ________ or predefined exception.
Group of answer choices
USER-DEFINED
NON-PREDEFINED
USER-DEFINED
The ________ clause is used in non-predefined exception to tell the compiler to associate an exception name with a specific Oracle error
Group of answer choices
PRAGMA EXCEPTION_INIT
SQLERRM
RAISE_APPLICATION_ERROR
SQLCODE
PRAGMA EXCEPTION_INIT
Two methods for raising an exception:
Group of answer choices
Implicit, Explicit
Predefined, Non-predefined
Implicit, Explicit
You can use the ________________ procedure to return user-defined error messages from stored subprograms.
Group of answer choices
RAISE_APPLICATION_ERROR
PRAGMA EXCEPTION_INIT
SQLCODE
SQLERRM
RAISE_APPLICATION_ERROR
The following declaration is a PL/SQL syntax for defining a record.
Record_name table_name%rowtype;
Group of answer choices
True
False
t
Type and record declared in the outer block are visible only in the outer block.
Group of answer choices
True
False
False
A user-defined PL/SQL record contains one or more fields of scalar data type.
Group of answer choices
True
False
The cursor defined in the code below is ____
DECLARE
CURSOR cur_emps IS
SELECT employee_id, last_name, salary FROM employees
WHERE department_id = 30;
Group of answer choices
IMPLICIT CURSOR
Explicit Cursor
Explicit Cursor
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;
Group of answer choices
WHERE location_id = 1700
SELECT *
ORDER BY department_name;
IS
IS
The block below will display the country name and the area of each country in a chosen region. The region_id should be passed to the cursor as a parameter.
- DECLARE
- CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
- SELECT country_name, area FROM ____ WHERE region_id = p_region_id;
- country_rec country_curs%ROWTYPE;
- BEGIN
- OPEN country_curs(____);
- LOOP
- FETCH country_curs INTO ______;
- EXIT WHEN ________%NOTFOUND;
- DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | 11. country_rec.area);
- END LOOP;
- CLOSE ______;
- END;
What is missing in line #3?
countries
If you omit the ______ keyword, then the Oracle server waits indefinitely until the rows are available.
NOWAIT
DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(1);
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;
What is the parameter mode of the formal parameter?_____
IN
The block below will display the country name and the area of each country in a chosen region. The region_id should be passed to the cursor as a parameter. The block is tested using region 5 (South America).
DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(1);
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;
The missing element in in line 6 is Region_id.
False
The NOWAIT keyword is optional in the FOR UPDATE clause.
Group of answer choices
True
False
True
What symbol is used to terminate the TYPE statement?
DECLARE
TYPE person_dept IS . . . . . . . .
;
What symbol is used to enclose the elements of the TYPE structure?
()
The OPEN statement positions the cursor pointer at the first row.
True
False
True
The __________ keyword is used in user-defined exception for error notification.
RAISE
Code that defines the recovery actions to be performed when execution-time errors occur.
EXCEPTION HANDLER
The following statements are examples of ________________.
Entering an expiration date that has passed
Selecting more than one row into a single variable
Receiving “no rows returned” from a select statement
EXCEPTION
The ___________ contains the exceptions handlers.
EXCEPTION SECTION
The EXECUTE keyword is used in user-defined exception for error notification.
Group of answer choices
True
False
False
When code does not work as expected, PL/SQL raises an exception handler.
Group of answer choices
True
False
False
The OTHERS is an optional exception-handling clause that traps any exceptions that have not been explicitly handled.
Group of answer choices
True
False
True
Names for predefined exceptions must be declared in the declaration section.
Group of answer choices
True
False
The SQLCODE function returns the numeric value for the error code.
Group of answer choices
True
False
True
You can use the RAISE_APPLICATION_ERROR procedure to return user-defined error messages from stored subprograms.
Group of answer choices
True
False
True
Pragma declaration is used in declaring user-defined exceptions.
Group of answer choices
True
False
False