CREATE OR REPLACE PROCEDURE xxx_create_location_p
IS
l_effective_date DATE := TO_DATE ('01-JAN-1950', 'DD-MON-YYYY');
l_location_id NUMBER := NULL;
l_object_version_number NUMBER := NULL;
l_err_msg VARCHAR2 (2000) := NULL;
CURSOR get_details
IS
SELECT *
FROM xxx_location_t
WHERE location = 'XXXXX';
BEGIN
FOR fetch_details IN get_details
LOOP
BEGIN
l_location_id := NULL;
l_object_version_number := NULL;
hr_location_api.
create_location (
p_validate => FALSE,
p_effective_date => l_effective_date,
p_location_code => fetch_details.location,
p_description => fetch_details.description,
p_timezone_code => NULL,
p_tp_header_id => NULL,
p_ece_tp_location_code => NULL,
p_address_line_1 => fetch_details.address_line_1,
p_address_line_2 => fetch_details.address_line_2,
p_address_line_3 => NULL,
p_bill_to_site_flag => 'Y',
p_country => fetch_details.country,
p_designated_receiver_id => NULL,
p_in_organization_flag => 'Y',
p_inactive_date => NULL,
p_operating_unit_id => NULL,
p_inventory_organization_id => NULL,
p_office_site_flag => 'Y',
p_postal_code => NULL,
p_receiving_site_flag => 'Y',
p_region_1 => NULL,
p_region_2 => NULL,
p_region_3 => fetch_details.po_box,
p_ship_to_location_id => NULL,
p_ship_to_site_flag => 'Y',
p_style => fetch_details.country,
p_tax_name => NULL,
p_telephone_number_1 => NULL,
p_telephone_number_2 => NULL,
p_telephone_number_3 => NULL,
p_town_or_city => NULL,
p_loc_information13 => NULL,
p_loc_information14 => NULL,
p_loc_information15 => NULL,
p_loc_information16 => NULL,
p_loc_information17 => NULL,
p_loc_information18 => NULL,
p_loc_information19 => NULL,
p_loc_information20 => NULL,
p_attribute_category => NULL,
p_attribute1 => fetch_details.location_arabic,
p_attribute2 => NULL,
p_attribute3 => NULL,
p_attribute4 => NULL,
p_attribute5 => NULL,
p_attribute6 => NULL,
p_attribute7 => NULL,
p_attribute8 => NULL,
p_attribute9 => NULL,
p_attribute10 => NULL,
p_attribute11 => NULL,
p_attribute12 => NULL,
p_attribute13 => NULL,
p_attribute14 => NULL,
p_attribute15 => NULL,
p_attribute16 => NULL,
p_attribute17 => NULL,
p_attribute18 => NULL,
p_attribute19 => NULL,
p_attribute20 => NULL,
p_global_attribute_category => NULL,
p_global_attribute1 => NULL,
p_global_attribute2 => NULL,
p_global_attribute3 => NULL,
p_global_attribute4 => NULL,
p_global_attribute5 => NULL,
p_global_attribute6 => NULL,
p_global_attribute7 => NULL,
p_global_attribute8 => NULL,
p_global_attribute9 => NULL,
p_global_attribute10 => NULL,
p_global_attribute11 => NULL,
p_global_attribute12 => NULL,
p_global_attribute13 => NULL,
p_global_attribute14 => NULL,
p_global_attribute15 => NULL,
p_global_attribute16 => NULL,
p_global_attribute17 => NULL,
p_global_attribute18 => NULL,
p_global_attribute19 => NULL,
p_global_attribute20 => NULL,
p_business_group_id => NULL,
p_location_id => l_location_id,
p_object_version_number => l_object_version_number);
UPDATE xxx_location_t alt
SET alt.process_flag = 'Y', err_msg = NULL
WHERE alt.location = fetch_details.location;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
UPDATE xxx_location_t alt
SET alt.process_flag = 'N', err_msg = l_err_msg
WHERE alt.location = fetch_details.location;
COMMIT;
END;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END;
No comments:
Post a Comment