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 -> drop foreign key

drop foreign key

From: oracle1 <santyspamsharma_at_hotmail.com>
Date: Mon, 10 Mar 2003 13:52:17 -0800
Message-ID: <b4j1b3$20rnjl$1@ID-84096.news.dfncis.de>


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

Original text of this message

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