Oracle constraints
Update foreign keys with new value in Oracle
Suppose you have a table and you want to change one of this table primary id. you can use the following scrpit.primary ID here is "PK_S"
BEGIN
FOR i IN (SELECT a.table_name, c.column_name
FROM user_constraints a, user_cons_columns c
WHERE a.CONSTRAINT_TYPE = 'R'
AND a.R_CONSTRAINT_NAME = 'PK_S'
AND c.constraint_name = a.constraint_name) LOOP
EXECUTE IMMEDIATE 'update ' || i.table_name || ' set ' || i.column_name ||
'=to_number(''1000'' || ' || i.column_name || ') ';
END LOOP;
END;