DECLARE
CURSOR c1
IS
SELECT haou_tl.*,
REPLACE (haou_tl.name, '&', 'And') new_org_name,
haou.object_version_number
FROM hr_all_organization_units_tl haou_tl,
hr_all_organization_units haou
WHERE haou_tl.language = 'US'
AND INSTR (haou_tl.name, '&') > 0
AND haou.organization_id = haou_tl.organization_id;
l_duplicate_org_warning BOOLEAN;
BEGIN
FOR i IN c1
LOOP
l_duplicate_org_warning := NULL;
BEGIN
hr_organization_api.
update_organization (
p_validate => FALSE,
p_effective_date => SYSDATE,
p_name => i.new_org_name,
p_organization_id => i.organization_id,
p_object_version_number => i.object_version_number,
p_duplicate_org_warning => l_duplicate_org_warning);
COMMIT;
DBMS_OUTPUT.put_line (i.organization_id || ' has
been updated !!!');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.
put_line (
'Inner
Exception: ' || i.organization_id || '-' || SQLERRM);
END;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Main
Exception: ' || SQLERRM);
END;
No comments:
Post a Comment