nerdexam
Oracle

1Z0-146 · Question #102

Examine the following command to create the table EMPLOYEES_TEMP and the PL/SQL block. CREATE TABLE employees_temp (empid NUMBER(6) NOT NULL, deptid NUMBER(6) CONSTRAINT c_emp_deptid CHECK (deptid…

The correct answer is A. V_EMPREC.DEPTNAME would display a null value because the default value is not inherited. D. Assigning the value 50 to V_EMPREC.DEPTID would work because the check constraint is not inherited. You can use %TYPE or %ROWTYPE to specify the base type. When %TYPE provides the data type of a database column, the subtype inherits the size constraint (if any) of the column. The subtype does not inherit other kinds of column constraints, such as NOT NULL or check constraint…

Advanced PL/SQL Features

Question

Examine the following command to create the table EMPLOYEES_TEMP and the PL/SQL block. CREATE TABLE employees_temp (empid NUMBER(6) NOT NULL, deptid NUMBER(6) CONSTRAINT c_emp_deptid CHECK (deptid BETWEEN 100 AND 200), salary Number(8), deptname VARCHAR2(30) DEFAULT 'Sales') / DECLARE SUBTYPE v_emprec_subtype IS employees_temp%ROWTYPE; v_emprec v_emprec_subtype; BEGIN v_emprec.empid := NULL; v_emprec.salary := 10000.002; v_emprec.deptid := 50; DBMS_OUTPUT.PUT_LINE('v_emprec.deptname: ' || v_emprec.deptname); END; / Which statements are true about the above PL/SQL block? (Choose two.)

Options

  • AV_EMPREC.DEPTNAME would display a null value because the default value is not inherited.
  • BAssigning null to V_EMPREC.EMPID would generate an error because the null constraint is inherited.
  • CAssigning the value 1000.002 to V_EMPREC.SALARY would generate an error because of the decimal.
  • DAssigning the value 50 to V_EMPREC.DEPTID would work because the check constraint is not inherited.

How the community answered

(62 responses)
  • A
    79% (49)
  • B
    6% (4)
  • C
    15% (9)

Explanation

You can use %TYPE or %ROWTYPE to specify the base type. When %TYPE provides the data type of a database column, the subtype inherits the size constraint (if any) of the column. The subtype does not inherit other kinds of column constraints, such as NOT NULL or check constraint, or the default value

Topics

#SUBTYPE#percent ROWTYPE#constraint inheritance#default value inheritance

Community Discussion

No community discussion yet for this question.

Full 1Z0-146 Practice