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 Implementation Question

Re: Constraint Implementation Question

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 02 Dec 1998 04:20:14 GMT
Message-ID: <3666bfab.3306754@192.86.155.100>


A copy of this was sent to dan.hield_at_mcmail.com (if that email address didn't require changing) On Tue, 01 Dec 1998 21:47:52 GMT, you wrote:

>I have an Oracle7 database on which I wish to enforce a table column to only
>contain upper case text. Can anyone tell me if this can be implemented
>declaratively or must it be done with the use of a trigger? Which ever the
>case, can you offer any suggestions that would help me do such a thing?
>
>Many thanks!
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

you can do it with a declaritive constraint as:

SQL> create table T ( some_data varchar2(30) check (upper(some_data) = some_data) );

Table created.

SQL> insert into t values ( 'x' );
insert into t values ( 'x' )

                   *

ERROR at line 1:
ORA-02290: check constraint (TKYTE.SYS_C0031569) violated

SQL> insert into t values ( 'X' );

1 row created.  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Tue Dec 01 1998 - 22:20:14 CST

Original text of this message

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