HRMS API: Create Phone (hr_phone_api.create_phone)
DECLARE
v_error VARCHAR2 (400);
p_date_from DATE;
p_date_to DATE;
p_phone_type VARCHAR2 (200);
p_phone_number VARCHAR2 (200);
p_parent_id NUMBER;
p_parent_table VARCHAR2 (200);
p_attribute_category VARCHAR2 (200);
p_attribute1 VARCHAR2 (200);
p_attribute2 VARCHAR2 (200);
p_validate BOOLEAN;
p_effective_date DATE;
p_party_id NUMBER;
p_validity VARCHAR2 (200);
p_object_version_number NUMBER;
p_phone_id NUMBER;
CURSOR c1
IS
SELECT ph.employee_number, ph.TYPE, ph.phone, pap.effective_start_date,
pap.person_id, ph.valid_flag
FROM xx_phone_upload_new ph, per_all_people_f pap
WHERE ph.employee_number = pap.employee_number
AND NVL (ph.valid_flag, 'N') <> 'Y';
-- AND PH.EMPLOYEE_NUMBER= 'ISP00015';
BEGIN
FOR c1_rec IN c1
LOOP
p_date_from := c1_rec.effective_start_date;
p_date_to := NULL;
SELECT lookup_code
INTO p_phone_type
FROM fnd_lookup_values_vl
WHERE lookup_type = 'PHONE_TYPE'
AND UPPER (meaning) = UPPER (c1_rec.TYPE);
p_phone_number := c1_rec.phone;
p_parent_id := c1_rec.person_id;
p_parent_table := 'PER_ALL_PEOPLE_F';
p_attribute_category := NULL;
p_attribute1 := NULL;
p_attribute2 := NULL;
p_validate := FALSE;
p_effective_date := c1_rec.effective_start_date;
p_party_id := NULL;
p_validity := NULL;
p_object_version_number := NULL;
p_phone_id := NULL;
BEGIN
apps.hr_phone_api.create_phone (p_date_from,
p_date_to,
p_phone_type,
p_phone_number,
p_parent_id,
p_parent_table,
p_attribute_category,
p_attribute1,
p_attribute2,
p_validate,
p_effective_date,
p_party_id,
p_validity,
p_object_version_number,
p_phone_id
);
UPDATE xx_phone_upload_new
SET valid_flag = 'Y',
error_msg = NULL
WHERE employee_number = c1_rec.employee_number;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
v_error := null;
v_error := SQLERRM;
UPDATE xx_phone_upload_new
SET valid_flag = 'N',
error_msg = v_error
WHERE employee_number = c1_rec.employee_number;
COMMIT;
END;
END LOOP;
END;