Using Oracle 10g, I need to rename a bunch of FK constraints which all end in LITE to include an FK prefix.
My thinking was (I've ensured all names are short enough to accommodate the prefix):
DECLARE
v_name VARCHAR2(30 BYTE);
v_new_name VARCHAR2(30 BYTE);
CURSOR c1 is select CONSTRAINT name from user_constraints where constraint_type = 'R' and constraint_name like '%_LITE';
BEGIN
OPEN c1;
LOOP
FETCH c1 into v_name;
EXIT when c1%NOTFOUND;
v_new_name:= 'FK_' || v_name;
update user_constraints SET constraint_name = v_new_name where constraint_name = v_name;
END LOOP;
close c1;
END;
Any reason why that would be unsafe and I should have to create alter table statements instead?