Q1. Consider the following SELECT-INTO statement in a PL/SQL block. What happens
ID: 3866749 • Letter: Q
Question
Q1. Consider the following SELECT-INTO statement in a PL/SQL block. What happens if there is NO row satisfying the WHERE condition?
......
SELECT COUNT(*)
INTO v_n
FROM tab1
WHERE col_15 > 10 OR col_20 > 10;
......
A. The SELECT-INTO statement executes successfully.
B. A NO_DATA_FOUND exception is raised.
C. A TOO_MANY_ROWS exception is raised.
D. A ZERO_DIVIDE exception is raised.
Q2. In which section of a PL/SQL block is a WHEN TOO_MANY_ROWS THEN statement allowed (The TOO_MANY_ROWS is a predefined exception for ORA-01422)?
A. DECLARATION
B. EXECUTION
C. EXCEPTION
D. All of the above
Q3. Evaluate the following CASE statement:
CASE v_input
WHEN 10 THEN v_out := 100; v_input := 30;
WHEN 20 THEN v_out := 202; v_input := 40;
WHEN 30 THEN v_out := 606; v_input := 50;
WHEN 40 THEN v_out := 410; v_input := 60;
WHEN 50 THEN v_out := 881;
ELSE v_out := 991;
END CASE;
If v_input is 20, which value would be assigned to v_out?
A. 100
B. 202
C. 410
D. 606
E. 881
F. 991
G. None of the above
Q4. In the DECLARATION section of a PL/SQL block, you declare these variables:
v_room_100, v_room_200 VARCHAR2(15);
Why does this statement cause an error?
A. The NOT NULL keyword is missing.
B. The size (15) of the data type VARCHAR2 cannot be specified.
C. Multiple variables cannot be declared in the same statement.
D. A default value must be assigned to each variable.
E. All of the above.
Q5. PL/SQL records of the same declared type can be compared for equality by using the equality operator (=).
DECLARE
TYPE t_type IS RECORD (p_id NUMBER, p_age NUMBER);
v_a t_type;
v_b t_type;
BEGIN
......
IF v_a = v_b THEN
DBMS_OUTPUT.PUT_LINE('v_a = v_b');
ELSE
DBMS_OUTPUT.PUT_LINE('v_a != v_b');
END IF;
END;
A. TRUE
B. FALSE
Explanation / Answer
Q1. NO_DATA_FOUND Exception will be called
Since none of the rows is selected using the following where condition hence these exception is given out.
Q2. Exeception
Since it is an exception it will be in used in exception code
Q3 Case statement v_input =20 them v_output=202
Q4. Multiple variable cannot be declared in same statement
Q5.TRUE
Yes the same type can be compare by equality operator.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.