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: Check Constraints

Re: Check Constraints

From: casper44 <dkniveton71_at_msn.com>
Date: 18 Mar 2002 15:20:22 -0800
Message-ID: <be3be537.0203181520.62bc01f0@posting.google.com>


"Joshua" <a.j.van.rooijen_at_bluevision.nl> wrote in message news:<R0kl8.396807$hy4.16398396_at_Flipper>...
> you can do that by making database triggers update and/or insert and put the
> validation code in these.
>
>
> "casper44" <dkniveton71_at_msn.com> wrote in message
> news:be3be537.0203170526.a793d85_at_posting.google.com...
> > How do I check to make sure a attribute of type VARCHAR2 is greater
> > than 2 characters? For example if I create a table and the attribute
> > is:
> >
> > organization VARCHAR2(50) NOT NULL,
> >
> > and I also want it to always be greater than 2 characters.
> >
> > Thanks.

Isn't there an easier way to do this like if I want to check for a number greater than 3 I could do:
CHECK constraint (organization > 3);
or if I wanted to check to ensure users put a @ in a field called email I could say:
email VARCHAR2(20),
CONSTRAINT email_check
CHECK (email LIKE ('%@%');

Thanks. Received on Mon Mar 18 2002 - 17:20:22 CST

Original text of this message

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