Changing a Customer's Client Code#
Identify the tables that need to be changed#
select --table_name, column_name, data_type --'select count(*) from '|| table_name ||' where '|| column_name ||' = ''PXP'';' 'update '|| table_name ||' set '|| column_name ||' = :new where '|| column_name ||' = :old;' from user_tab_cols where column_name in ('CUSTOMER_CODE', 'USER_CODE', 'CUST_CODE') and table_name not in (select view_name from user_views) and data_type <> 'NUMBER' --where column_name like '%USER%' order by table_name, column_id, column_name ;
Run in SQL Developer#
- update HLC_ASSIGNMENTS set CUST_CODE = :new where CUST_CODE = :old;
- update HLC_CUST_ENVIRONMENTS set USER_CODE = :new where USER_CODE = :old;
- update HLC_CUST_PROFILE set USER_CODE = :new where USER_CODE = :old;
- update HLC_CUST_SUBORGS set USER_CODE = :new where USER_CODE = :old;
- update HLC_FILES_DOWNLOADED set USER_CODE = :new where USER_CODE = :old;
- update HLC_HUG set CUST_CODE = :new where CUST_CODE = :old;
- update HLC_HUG_2007_PARTICIPANTS set CUST_CODE = :new where CUST_CODE = :old;
- update HLC_HUG_2010_PARTICIPANTS set CUST_CODE = :new where CUST_CODE = :old;
- update HLC_NOTIFICATIONS_SENT set CUSTOMER_CODE = :new where CUSTOMER_CODE = :old;
- update HLC_PATCHES_SENT set CUSTOMER_CODE = :new where CUSTOMER_CODE = :old;
- update HLC_QUOTES set CUSTOMER_CODE = :new where CUSTOMER_CODE = :old;
- update HLC_TASKS set CUSTOMER_CODE = :new where CUSTOMER_CODE = :old;
- update HLC_TIMESHEETS set USER_CODE = :new where USER_CODE = :old;
- update HLC_TRIP_REPORTS set CUST_CODE = :new where CUST_CODE = :old;
- update HLC_WORK_DAYS set USER_CODE = :new where USER_CODE = :old;
- update NXSCUSTE set USER_CODE = :new where USER_CODE = :old;