Showing posts with label Create Extra Information. Show all posts
Showing posts with label Create Extra Information. Show all posts

Wednesday, March 23, 2016

API to Create Person Extra Information record

Salam Alaikum,

   It is one very important and widely used API that i share with you today... It is the API used to upload Extra Information for a person in Oracle HR. It is very simple and straight forward, and as you know each Extra Information has different (attributes/attribute type) so you have to consider getting to know some the dependencies (if exists) between the attributes before uploading.

   That being said, i share one simple API, with three attributes only:

DECLARE
   l_true                       BOOLEAN := FALSE;
   l_PERSON_ID                  NUMBER := 31785;
   l_INFORMATION_TYPE           VARCHAR2 (2000) := 'LAST_NAME_DETAILS';
   l_pei_information_category   VARCHAR2 (2000) := 'LAST_NAME_DETAILS';
   l_PEI_INFORMATION1           VARCHAR2 (2000) := 'Test1';
   l_PEI_INFORMATION2           VARCHAR2 (2000) := 'Test2';
   l_PEI_INFORMATION3           VARCHAR (200) := TO_CHAR (TO_DATE ('01-JAN-1999', 'DD-MON-YYYY'),'YYYY/MM/DD HH24:MI:SS');
   -- Output Variables
   l_PERSON_EXTRA_INFO_ID       NUMBER;
   l_OBJ                        NUMBER;

   CURSOR csr_ovn
   IS
      SELECT MAX (object_version_number)
        FROM per_all_people_f
       WHERE person_id = l_person_id;
BEGIN
   OPEN csr_ovn;
   FETCH csr_ovn INTO l_obj;
   CLOSE csr_ovn;

   HR_PERSON_EXTRA_INFO_API.CREATE_PERSON_EXTRA_INFO (
      p_validate                   => l_true,
      p_person_id                  => l_person_id,
      p_INFORMATION_TYPE           => l_INFORMATION_TYPE,
      p_pei_information_category   => l_pei_information_category,
      p_PEI_INFORMATION1           => l_PEI_INFORMATION1,
      p_PEI_INFORMATION2           => l_PEI_INFORMATION2,
      p_PEI_INFORMATION3           => l_PEI_INFORMATION3,
      p_PERSON_EXTRA_INFO_ID       => l_PERSON_EXTRA_INFO_ID,
      p_object_version_number      => l_obj);
END;

*note: the P_PERSON_EXTRA_INFO_ID and P_OBJECT_VERSION_NUMBER are both out parameters.

  Hope you found it useful, feel free to leave a comment if have any note on the subject.