Create table subjects(Sub_id number(2) primary key,Subj_name varchar(50)); Insert into subjects values (null,’Oracle’); What will be the output of the given query?
Answer options
A
The query will generate an ORA-01400: cannot insert NULL into primary key.
B
The query will execute successfully.
C
The query will insert a NULL value as stud_id.
D
The query will generate a duplicate key error.
Correct answer: The query will generate an ORA-01400: cannot insert NULL into primary key.
Explanation
Primary key columns cannot be NULL; omitting Sub_id causes ORA-01400.