create or replace package util_pkg as /**************************************************************************** * util_pkg * * version 1.0 - 21 July 2007 - Patrick Haston * * A collection of useful utilities. * ****************************************************************************/ ----------------------------------------------------------------------------- -- move_fk -- -- this procedure is used to move all foreign key references from one row in -- a table to another. -- If there is a problem, it returns a negative number: -- return value = meaning -- 0 = no problem, just no references to the old_id. -- -1 = old_id was invalid -- -2 = new_id was invalid -- -3 = table_name was invalid -- -4 = other problem encountered -- -- Parameters: -- p_table_name - the name of the table which the foreign keys may be pointing to -- p_old_id - the id to be de-referenced -- p_new_id - the id which foreign keys should now reference -- function move_fk(p_table_name in varchar2, p_old_id in number, p_new_id in number) return number; end util_pkg;