Which statement is true about the output of the PL/SQL block?

View the Exhibit to examine the PIVSQL block.

Which statement is true about the output of the PL/SQL block?

View the Exhibit to examine the PIVSQL block.

Which statement is true about the output of the PL/SQL block?

A.
It executes and the Output is emprec.deptname: .

B.
It executes and the Output is emprec.deptname: Sales.

C.
It produces an error because NULL is assigned to the emprec.empid field in the record.

D.
It produces anerror because the CHECK constraint is violated while assigning a value to the
emprec.deptid field in the record.



Leave a Reply 8

Your email address will not be published. Required fields are marked *


alex

alex

The variable emprec does dot inherits the constraints. The correct answer is A.

Vova M

Vova M

A

create table employee_temp(
empid number(6) not null primary key,
deptid number(6) constraint c_employee_temp_dept check (deptId between 100 and 200),
deptname varchar2(30) default ‘Sales’);

declare
emprec employee_temp %rowtype;
begin
emprec.empid := null;
emprec.deptid := 50;
dbms_output.put_line(’emprec.deptname :’ || emprec.deptname);
end;

alex

alex

“The %ROWTYPE attribute provides a record type that represents a row in a table or view. Columns in a row and corresponding fields in a record have the same names and datatypes. However, fields in a %ROWTYPE record do not inherit constraints, such as the NOT NULL or check constraint, or default values.”
Source: https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/fundamentals.htm

Correct Answer: A