Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> drop foreign key
Currently I am using following sql for dropping a foreign key on table
TESTCHILD column id. Constraint name is system generated , so I can't drop
it simply by using drop constraint clause without selecting it first from
dictionary. Is there any other way to do it? I am using 8.1.7 and 9.1
Thanks
santysharma
declare
cons_name varchar2(100);
drop_string varchar2(200);
begin
select constraint_name into cons_name
from user_constraints where
table_name = 'TESTCHILD' and constraint_type ='R';
drop_string := 'ALTER TABLE TESTCHILD DROP CONSTRAINT '||cons_name;
execute immediate(drop_string);
end;
Received on Mon Mar 10 2003 - 15:52:17 CST