Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Constraint question - maybe simple?
dean wrote:
> I have a table TRAIN with several fields, and the three ones of
> importance are:
>
> 1. TRAIN_I number not null
> 2. P_VERSION_I number not null
> 3. TRN_SYMBOL_I varchar2(6) not null
>
> The primary key is on TRAIN_I and P_VERSION_I.
>
> Is it possible to add a constraint such that there can be several pairs
> of (TRAIN_I, TRN_SYMBOL_I) but they must match? What I mean is, if
> there is one record with TRAIN_I = 123, and TRN_SYMBOL_I = ABC, and we
> add another record with TRAIN_I = 123 (and a different P_VERSION_I of
> course), then it is constrained to have TRN_SYMBOL_I = ABC?
ASSERT NOT EXISTS (
select * from TRAIN t1, t2
where t1.TRAIN_I=t2.TRAIN_I
and t1.TRN_SYMBOL_I!=t2.TRN_SYMBOL_I
);
Then google "enforce constraints materialized view" Received on Mon Oct 24 2005 - 13:12:26 CDT
![]() |
![]() |