1Z0-149 practice question 9 of 15

Which three SQL statements, embedded in PL/SQL, typically benefit from using variables declared with %ROWTYPE? (Choose three.)

Full set: 65 questions
Answer options
A:

A. CREATE

B:

B. DROP

C:

C. UPDATE

Correct answer
D:

D. SELECT

Correct answer
E:

E. DELETE

F:

F. ALTER

G:

G. INSERT

Correct answer
Correct Answer:
C. C. UPDATE; D. D. SELECT; G. G. INSERT
Explanation

The %ROWTYPE attribute creates a record variable that can hold an entire row from a table or view. It is most beneficial for DML statements that operate on entire rows. SELECT INTO ... can fetch a complete row into a %ROWTYPE variable (D). INSERT can use a %ROWTYPE variable to insert a complete row with the VALUES clause (G). UPDATE can use a %ROWTYPE variable to update multiple columns in a row at once using the SET ROW clause (C). These statements are simplified by treating the row as a single unit.

Why Incorrect

A. CREATE Incorrect. CREATE is a DDL statement that defines database objects; it does not operate on rows of data.
B. DROP Incorrect. DROP is a DDL statement that removes database objects; it does not operate on rows of data.
E. DELETE Incorrect. DELETE typically operates on rows identified by a key in the WHERE clause and does not directly use the full row structure provided by %ROWTYPE in the statement itself.
F. ALTER Incorrect. ALTER is a DDL statement that modifies database objects; it does not operate on rows of data.

References

1. Oracle Database PL/SQL Language Reference, 23c. Section 3.8.1, "Declaring Items Using the %ROWTYPE Attribute". This section explicitly shows examples of using %ROWTYPE with SELECT INTO, INSERT, and UPDATE SET ROW.

2. Oracle Database PL/SQL Language Reference, 23c. Section 6.4.3, "UPDATE Statement". It documents the SET ROW clause, which "assigns the values of a record variable to a row."

3. Oracle Database PL/SQL Language Reference, 23c. Section 6.4.2, "INSERT Statement". It shows an example of INSERT INTO ... VALUES (recordvariable).

Scroll to Top