Which rows would be made permanent in the CUST table?

View the Exhibit and examine the structure of the CUST table.
Evaluate the following SQL statements executed in the given order:
ALTER TABLE cust
ADD CONSTRAINT cust_id_pk PRIMARY KEY(cust_id) DEFERRABLE INITIALLY DEFERRED; INSERT
INTO cust VALUES (1,’RAJ’); –row 1
INSERT INTO cust VALUES (1,’SAM’); –row 2
COMMIT;
SET CONSTRAINT cust_id_pk IMMEDIATE;
INSERT INTO cust VALUES (1,’LATA’); –row 3
INSERT INTO cust VALUES (2,’KING’); –row 4
COMMIT;
Which rows would be made permanent in the CUST table?

View the Exhibit and examine the structure of the CUST table.

Evaluate the following SQL statements executed in the given order:

ALTER TABLE cust
ADD CONSTRAINT cust_id_pk PRIMARY KEY(cust_id) DEFERRABLE INITIALLY DEFERRED; INSERT
INTO cust VALUES (1,’RAJ’); –row 1
INSERT INTO cust VALUES (1,’SAM’); –row 2
COMMIT;
SET CONSTRAINT cust_id_pk IMMEDIATE;
INSERT INTO cust VALUES (1,’LATA’); –row 3
INSERT INTO cust VALUES (2,’KING’); –row 4
COMMIT;

Which rows would be made permanent in the CUST table?

A.
row 4 only

B.
rows 2 and 4

C.
rows 3 and 4

D.
rows 1 and 4



Leave a Reply 2

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


user

user

Initially immediate — check the constraint at the end of statement execution

Initially deferred — wait to check the constraint until the transaction ends

The transaction fails and is rolled back, because the check constraint is checked upon COMMIT . ORA-02091

user

user

Without the COMMIT statement in line 5, all the four rows will be rolled back at the last COMMIT statement.