Originally posted by sfdba
...is there a way to diable the primary keys of all tables for a given database in a single command?
All tables? Even SYS' tables :-)

Here is something that will generate a script for you (for schema SCOTT):

--
set serveroutput on
set verify off
prompt
--
DECLARE
--
w_owner varchar2(30);
w_table varchar2(30);
w_name varchar2(50);
sql_text varchar2(256);
Dynamic_Cursor integer;
dummy integer;
table_usage pls_integer;
--
cursor trii is
select
TABLE_NAME, CONSTRAINT_NAME
from
DBA_CONSTRAINTS
where
owner = 'SCOTT' and status = 'ENABLED' and constraint_type = 'P'
order by
TABLE_NAME desc;
--
BEGIN
--
dbms_output.enable(60000);
open trii;
fetch trii into w_table, w_name;
while trii%FOUND loop
begin
Dynamic_Cursor := dbms_sql.open_cursor;
sql_text := 'alter table SCOTT.'||w_table||' disable constraint '||w_name||' cascade';
dbms_sql.parse(Dynamic_Cursor, sql_text, dbms_sql.v7);
dummy := dbms_sql.execute(Dynamic_Cursor);
dbms_sql.close_cursor(Dynamic_Cursor);
exception
when others then null;
end;
fetch trii into w_table, w_name;
end loop;
close trii;
--
END;
/