Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Constraint question - maybe simple?

Re: Constraint question - maybe simple?

From: <mikharakiri_nospaum_at_yahoo.com>
Date: 24 Oct 2005 11:12:26 -0700
Message-ID: <1130177546.834371.122120@g44g2000cwa.googlegroups.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US