Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: CUSTOM data integrity constraint
Thomas,
is there way to maintain range for two columns using check constraint.
c_1 c_2
1 5 6 10
or else you have do it in a trigger.
Thanks in advance ted chyn
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....
>
> --
> 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
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Thu Sep 16 1999 - 19:02:24 CDT
![]() |
![]() |