Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Check constraints refering to another column
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
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