Which two statements art true about the instead of triggers’ (choose two.)
A.
Delete operations cannot be performed using the instead of triggers.
B.
The instead or triggers must be created to add or modify data through any view.
C.
The instead of triggers can be written only for views, and the before and after timing options are
not valid.
D.
The check option for views Is not enforced when Insertions or updates to the view are
performed by using the instead of trigger.
Explanation:
c,d
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/triggers.htm#i1025919
B,C
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/triggers.htm#i1025919
Piero
C D
This question seems to divide us more ‘being made by others in response
I believe they are right C and D, but since the answers are different,
I’d like to read some other opinions,
My opinion;
A is wrong, any DML can ‘be performed on base table of view through the trigger of instead
B is wrong, you can change the “simple” views without a trigger “instead of”
C is correct , no one else then a complex view need a trigger “instead of” to work
D is correct check options work for view, not for table (“instead of”)
C,D
c, d
D is indeed right. See following test here:
SQL> CREATE OR REPLACE VIEW v_emp3 AS SELECT * FROM TM_EMP3 WHERE PK1 BETWEEN 1 and 100 WITH CHECK OPTION;
View created.
SQL> INSERT INTO v_emp3 (PK1, PK2, VCH, DT) VALUES (550, 550, NULL, sysdate);
INSERT INTO v_emp3 (PK1, PK2, VCH, DT) VALUES (550, 550, NULL, sysdate)
*
ERROR at line 1:
ORA-01402: view WITH CHECK OPTION where-clause violation
SQL> CREATE OR REPLACE TRIGGER v_emp3_trig
2 INSTEAD OF INSERT ON v_emp3
3 FOR EACH ROW
4 BEGIN
5 INSERT INTO tm_emp3 (pk1, pk2, vch, dt) values (:NEW.PK1, :NEW.pk2, :NEW.VCH || ‘T’, :NEW.dt + 1);
6 END;
7 /
Trigger created.
SQL> INSERT INTO v_emp3 (PK1, PK2, VCH, DT) VALUES (550, 550, NULL, sysdate);
1 row created.
C and D are correct.
Refer => https://docs.oracle.com/cd/B12037_01/appdev.101/b10795/adfns_tr.htm