Sunday, January 11, 2015

API To Create Establishment (School/College)

Salam Alaikum,

   Following the API that can be used for creating a Establishment in HR. That Can either be a School or college... etc. Please note that some attributes given in the API may deffer based on the setup.

DECLARE
   CURSOR schools
   IS
      SELECT xx_sch.ROWID,
             xx_sch.*
        FROM xxx_schools_info xx_sch
        WHERE 1 = 1 AND NVL (upload_status, 'N') = 'N';

   l_establishment_id        per_establishments.establishment_id%TYPE;
   l_object_version_number   per_establishments.object_version_number%TYPE;
BEGIN
   FOR i_rec IN schools
   LOOP
      per_est_ins.ins (p_establishment_id           => l_establishment_id,
                       p_name                       => i_rec.establishment_name,
                       p_location                   => i_rec.LOCATION,
                       p_attribute_category         => NULL,
                       p_attribute1                 => i_rec.country,
                       p_attribute2                 => i_rec.area,
                       p_attribute3                 => i_rec.city,
                       p_object_version_number      => l_object_version_number,
                       p_validate                   => FALSE
                      );

      UPDATE xxx_schools_info
         SET upload_status = 'Y',
             establishment_id = l_establishment_id
       WHERE ROWID = i_rec.ROWID;
   END LOOP;
END;

  As always, feel free to leave a comment if have any note on the subject.        

No comments:

Post a Comment