Thursday, January 9, 2014

API to Upload Organization in Arabic

DECLARE
      CURSOR get_details
      IS
         SELECT haou.organization_id,
                dop.organization_name,
                dop.organization_arabic
           FROM xxxx_organization_t dop, hr_all_organization_units haou
          WHERE UPPER (dop.organization_name) = UPPER (haou.name);

      l_db_nls_language   VARCHAR2 (500) := NULL;
      l_err_msg           VARCHAR2 (500) := NULL;
   BEGIN
      FOR fetch_details IN get_details
      LOOP
         fnd_global.
          set_nls (p_nls_language                => 'ARABIC',
                   p_nls_date_format             => NULL,
                   p_nls_date_language           => NULL,
                   p_nls_numeric_characters      => NULL,
                   p_nls_sort                    => NULL,
                   p_nls_territory               => NULL,
                   p_db_nls_language             => l_db_nls_language,
                   p_db_nls_date_format          => l_db_nls_language,
                   p_db_nls_date_language        => l_db_nls_language,
                   p_db_nls_numeric_characters   => l_db_nls_language,
                   p_db_nls_sort                 => l_db_nls_language,
                   p_db_nls_territory            => l_db_nls_language,
                   p_db_nls_charset              => l_db_nls_language);


         BEGIN
            hr_ort_pkg.
             translate_row (
               x_organization_id   => fetch_details.organization_id,
               x_owner             => '-1',
               x_name              => fetch_details.organization_arabic);

            UPDATE xxxx_organization_t
               SET ar_process_flag = 'Y', err_msg = NULL
             WHERE UPPER (organization_name) =
                      UPPER (fetch_details.organization_name);


            COMMIT;
         EXCEPTION
            WHEN OTHERS
            THEN
               l_err_msg := SQLERRM;

               UPDATE xxxx_organization_t
                  SET ar_process_flag = 'N', err_msg = l_err_msg
                WHERE UPPER (organization_name) =
                         UPPER (fetch_details.organization_name);

               COMMIT;
         END;
      END LOOP;

   END

No comments:

Post a Comment