Disable All constraints in single SQL statement... [message #199329] |
Mon, 23 October 2006 10:30  |
sidagam
Messages: 24 Registered: February 2005 Location: Hyderabad
|
Junior Member |
|
|
Hi All,
I need to diable all constraints in my table.
Using single SQL statement, will it be possible..
I know how to disable each constraint in table.
But my table is so big and it has many constraints.
So, could any body provide the syntax to disable constaints in table with single SQL statemet...
Awaiting your response.
Thanks & Regards,
Babu SRSB.
|
|
|
|
Re: Disable All constraints in single SQL statement... [message #199491 is a reply to message #199329] |
Tue, 24 October 2006 14:53  |
jigar
Messages: 74 Registered: July 2002
|
Member |
|
|
CREATE OR REPLACE PROCEDURE p_disable_constraint(p_table_name IN VARCHAR)
AS
CURSOR c_disable_constraint
IS
select constraint_name from all_constraints
where table_name = p_table_name;
BEGIN
FOR I in c_disable_constraint
LOOP
EXECUTE IMMEDIATE 'ALTER TABLE ' || p_table_name || ' DISABLE CONSTRAINT ' || i.constraint_name;
END LOOP;
END;
And execute the procedure with table name.
[Updated on: Tue, 24 October 2006 15:00] Report message to a moderator
|
|
|