Examine the commands:
CREATE TYPE typ_course_tab IS VARRAY(5) OF VARCHAR2(20)
/
CREATE TYPE typ_course_nst
AS TABLE OF typ_course_tab
/
CREATE TABLE faculty
(faculty_id NUMBER(5),
faculty_name VARCHAR2(30),
courses typ_course_nst)
NESTED TABLE courses STORE AS course_stor_tab
/
INSERT INTO faculty
VALUES (101, ‘Jones’, NULL);
UPDATE (SELECT courses FROM faculty WHERE faculty_id=101) SET courses =
typ_course_nst(11,’Oracle’); Which statement is true about the execution of these commands?
A.
All the commands execute successfully.
B.
Only the first two commands execute successfully.
C.
Only the first four commands execute successfully.
D.
Only the first three commands execute successfully.
C, last update command doesn’t execute.
C
C.
Type created.
Type created.
Table created.
1 row created.
UPDATE (SELECT courses FROM faculty WHERE faculty_id=101) SET courses = typ_course_nst (11,’Oracle’)
Error at line 19
ORA-00932: inconsistent datatypes: expected PLSQL.TYP_COURSE_TAB got NUMBER
Script Terminated on line 19.
Replace
UPDATE (SELECT courses FROM faculty WHERE faculty_id=101) SET courses = typ_course_nst (11,’Oracle’);
with
UPDATE (SELECT courses FROM faculty WHERE faculty_id=101) SET courses = typ_course_nst (typ_course_tab(11,’Oracle’));
SELECT * FROM faculty;
TOAD
FACULTY_ID FACULTY_NAME COURSES
101 Jones (DATASET)
Sql*Plus
FACULTY_ID FACULTY_NAME COURSES
101 Jones TYP_COURSE_NST(TYP_COURSE_TAB(’11’, ‘Oracle’))