Monday 2 April 2018

Script to add employee as buyer

DECLARE
   l_agent_id          NUMBER;
   l_employee_number   VARCHAR2 (20);
   l_buyer_rowid       VARCHAR2 (100);
BEGIN
   BEGIN
      SELECT person_id
        INTO l_agent_id
        FROM apps.per_all_people_f f
       WHERE employee_number = l_employee_number;
   EXCEPTION
      WHEN OTHERS
      THEN
         DBMS_OUTPUT.put_line (   'Unable to find Agent ID for '
                               || l_employee_number
                               || SQLERRM
                              );
   END;

   apps.po_agents_pkg.insert_row (x_rowid                    => l_buyer_rowid,
                                  x_agent_id                 => l_agent_id,
                                  x_last_update_date         => SYSDATE,
                                  x_last_updated_by          => 0,
                                  x_last_update_login        => 0,
                                  x_creation_date            => SYSDATE,
                                  x_created_by               => 0,
                                  x_location_id              => NULL,
                                  x_category_id              => NULL,
                                  x_authorization_limit      => NULL,
                                  x_start_date_active        => SYSDATE,
                                  x_end_date_active          => NULL,
                                  x_attribute_category       => NULL,
                                  x_attribute1               => NULL,
                                  x_attribute2               => NULL,
                                  x_attribute3               => NULL,
                                  x_attribute4               => NULL,
                                  x_attribute5               => NULL,
                                  x_attribute6               => NULL,
                                  x_attribute7               => NULL,
                                  x_attribute8               => NULL,
                                  x_attribute9               => NULL,
                                  x_attribute10              => NULL,
                                  x_attribute11              => NULL,
                                  x_attribute12              => NULL,
                                  x_attribute13              => NULL,
                                  x_attribute14              => NULL,
                                  x_attribute15              => NULL
                                 );
   COMMIT;
   DBMS_OUTPUT.put_line ('Setup as a buyer ' || l_employee_number);
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error in Setting up as Buyer ' || SQLERRM);
END;

No comments:

Post a Comment