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

Home -> Community -> Usenet -> c.d.o.server -> Re: CUSTOM data integrity constraint

Re: CUSTOM data integrity constraint

From: Nandakumar <N.Kumar_at_rocketmail.com>
Date: Tue, 24 Aug 1999 21:11:13 GMT
Message-ID: <7pv1p6$h7c$1@nnrp1.deja.com>

In article <37c7de9a.108513494_at_newshost.us.oracle.com>,   tkyte_at_us.oracle.com wrote:
> A copy of this was sent to Nandakumar <N.Kumar_at_rocketmail.com>
> (if that email address didn't require changing)
> On Tue, 24 Aug 1999 16:41:42 GMT, you wrote:
>
> >Hi,
> >
> >There are two fields in a table which are of datatype varchar2.
> >Say Field1, Field2.
> >When Field1 is NON NULL, Field2 CAN'T be NULL.
> >How could i impose this as a constraint to one of the fields?
> >...
> >I think this is achievable with INSERT trigger.
>
> create table t
> ( f1 int,
> f2 int,
> check ( f1 is null or ( f1 is not null and f2 is not null ) )
> )
> /
>
> if f1 is NULL, the data is OK
> if f1 is not null then f2 must also be not null....

Is it possible to attach this constraint to a field in a view made over the table t? ie) i want to restrict the constraint to ONLY one of the views of the table.

Thanks!
>
> --
> See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to
Oracle8i'...
> Current article is "Part I of V, Autonomous Transactions" updated June
21'st
>
> Thomas Kyte tkyte_at_us.oracle.com
> Oracle Service Industries Reston, VA USA
>
> Opinions are mine and do not necessarily reflect those of Oracle
Corporation
>

--
Nandakumar
Systems Analyst
New York
(N.Kumar_at_rocketmail.com)

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Tue Aug 24 1999 - 16:11:13 CDT

Original text of this message

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