Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Deleting a check option
Peter Poldervaart wrote in message <7cth9d$cnu$1_at_freyja.bart.nl>...
>I'm right now defining a database in Oracle 8. Now a would like to add
>constraints to my tables for which I use the ALTER TABLE XXX ADD CHECK
>field1 < field 2 or something. Now I would like to know if it is possible
to
>give a name to this constraint so that it is possible to remove this
>constraint in the future without having to remove the whole table.
>
>Peter P.
>p.poldervaart_at_wxs.nl
>
>
In Oracle 7, "anonymous" constraints are removed like this (I assume it's the same in Oracle 8):
As the table owner,
select constraint_name,search_condition
from user_constraints
where table_name = 'XXX'
and constraint_type = 'C';
Look through the search_conditions to find your constraint_name
Let's say it's SYS_C012345 ("anonymous" constraints are given a system-generated name)
alter table xxx
drop constraint sys_c012345;
(Also, in Oracle 7) If you want to name a constraint, you must do so when creating it:
alter table xxx
add constraint xxx_f1_lt_f2_ck check( field1 < field2 );
alter table xxx
drop constraint xxx_f1_lt_f2_ck;
Regards,
Roy Brokvam
roy.brokvam_at_conax.com
Received on Fri Mar 19 1999 - 11:25:37 CST
![]() |
![]() |