1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| SQL>
SQL> drop table tmatch;
Table dropped.
SQL> drop table tstade;
Table dropped.
SQL> drop materialized view mv;
Materialized view dropped.
SQL>
SQL>
SQL> whenever sqlerror exit failure;
SQL>
SQL> create table tstade(nst number primary key, npl number);
Table created.
SQL> create table tmatch(nm number primary key, nst number references tstade, nsp number);
Table created.
SQL>
SQL> create materialized view log on tmatch
2 with primary key, rowid
3 including new values;
Materialized view log created.
SQL>
SQL> create materialized view log on tstade
2 with primary key, rowid
3 including new values;
Materialized view log created.
SQL>
SQL> create materialized view mv
2 refresh force on commit
3 as
4 select tmatch.nm, tmatch.nst, tmatch.nsp, tstade.npl
5 from tmatch, tstade
6 where tmatch.nst = tstade.nst;
Materialized view created.
SQL>
SQL> alter table mv add constraint c_stade_trop_petit check (nsp <= npl);
Table altered.
SQL>
SQL>
SQL> insert into tstade values (1, 100);
1 row created.
SQL> insert into tmatch values (1, 1, 99);
1 row created.
SQL> insert into tmatch values (2, 1, 100);
1 row created.
SQL> commit;
Commit complete.
SQL> insert into tmatch values (3, 1, 101);
1 row created.
SQL> commit;
commit
*
ERROR at line 1:
ORA-12008: error in materialized view refresh path
ORA-02290: check constraint (TEST.C_STADE_TROP_PETIT) violated |
Partager