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: Check constraints refering to another column

Re: Check constraints refering to another column

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sun, 22 Nov 1998 17:52:58 GMT
Message-ID: <365f4f33.17503268@192.86.155.100>


A copy of this was sent to NBronke_at_t-online.de (Nicolas Bronke) (if that email address didn't require changing) On 22 Nov 1998 12:51:51 GMT, you wrote:

>Does exist a possibility, that a check constraint refers to another column
>or does I have to use triggers? I use Oracle 7.3x
>

if the other column is in the same table, then a simple table level check constraint will work, consider:

SQL> create table foo (
  2 x int,
  3 y int,
  4 constraint x_gt_y check ( x > y )   5 );

Table created.

SQL> insert into foo values ( 1, 2 );
insert into foo values ( 1, 2 )

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

SQL> insert into foo values (2, 1 );

1 row created.

>Regards
>Nicolas
>
 

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 Sun Nov 22 1998 - 11:52:58 CST

Original text of this message

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