DBA Data[Home] [Help]

APPS.OZF_TERR_LEVELS_PVT SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 49

         SELECT DISTINCT heirarchy_id
                    FROM ozf_terr_levels_all
                   WHERE heirarchy_id = l_start_node_id; */
Line: 74

             ozf_terr_levels_pvt.delete_terr_levels (
                p_api_version        => 1.0
               ,p_init_msg_list      => fnd_api.g_true
               ,p_commit             => fnd_api.g_false
               ,p_validation_level   => fnd_api.g_valid_level_full
               ,x_return_status      => x_return_status
               ,x_msg_data           => x_msg_data
               ,x_msg_count          => x_msg_count
               ,p_hierarchy_id       => l_start_node_id
             );
Line: 86

                  ozf_utility_pvt.write_conc_log ('   Failed to delete existing levels for terr_id ' || l_start_node_id);
Line: 92

                        ozf_utility_pvt.write_conc_log (' delete_terr_levels returns error. Msg count='
                                                         || i
                                                         || '-'
                                                         || x_msg_data);
Line: 105

          ozf_utility_pvt.write_conc_log ('Update active_flag to N for all OZF Territories to identify the old territories.');
Line: 107

          UPDATE ozf_terr_levels_all
          SET active_flag = 'N';
Line: 110

          ozf_utility_pvt.write_conc_log ('Territory Insertion Call');
Line: 111

          ozf_terr_levels_pvt.insert_terr_levels (
                    p_api_version        => 1.0
                   ,p_init_msg_list      => fnd_api.g_true
                   ,p_commit             => fnd_api.g_false
                   ,p_validation_level   => fnd_api.g_valid_level_full
                   ,x_return_status      => x_return_status
                   ,x_msg_data           => x_msg_data
                   ,x_msg_count          => x_msg_count
                   ,p_start_node_id      => p_start_node_id
          );
Line: 124

         ozf_utility_pvt.write_conc_log ('Update active_flag to N for all OZF Territories to identify the old territories.');
Line: 126

         UPDATE ozf_terr_levels_all
         SET active_flag = 'N';
Line: 129

         ozf_utility_pvt.write_conc_log ('Bulk Territories Insertion Call');
Line: 132

	 ozf_terr_levels_pvt.bulk_insert_terr_levels (
              p_api_version        => 1.0
             ,p_init_msg_list      => fnd_api.g_true
             ,p_commit             => fnd_api.g_false
             ,p_validation_level   => fnd_api.g_valid_level_full
             ,x_return_status      => x_return_status
             ,x_msg_data           => x_msg_data
             ,x_msg_count          => x_msg_count
         );
Line: 144

          ozf_utility_pvt.write_conc_log ('   Failed to insert levels for terr_id ' || l_start_node_id);
Line: 150

                ozf_utility_pvt.write_conc_log (' insert_terr_levels returns error. Msg count='
                                                 || i
                                                 || '-'
                                                 || x_msg_data);
Line: 181

   PROCEDURE insert_terr_levels (
      p_api_version        IN       NUMBER
     ,p_init_msg_list      IN       VARCHAR2 := fnd_api.g_false
     ,p_commit             IN       VARCHAR2 := fnd_api.g_false
     ,p_validation_level   IN       NUMBER := fnd_api.g_valid_level_full
     ,x_return_status      OUT NOCOPY      VARCHAR2
     ,x_msg_data           OUT NOCOPY      VARCHAR2
     ,x_msg_count          OUT NOCOPY      NUMBER
     ,p_start_node_id      IN       NUMBER
   ) IS
      l_api_name      CONSTANT VARCHAR2 (30) := 'Insert_terr_levels';
Line: 194

      l_insert_count           NUMBER;
Line: 207

         SELECT NVL (SUBSTRB (USERENV ('CLIENT_INFO'), 1, 10), -99)
           FROM DUAL;
Line: 211

         SELECT ozf_terr_levels_all_s.NEXTVAL
           FROM DUAL;
Line: 217

         SELECT terr_id
               ,territory_type_id
           FROM jtf_terr_all jtf
          WHERE jtf.terr_id = l_terr_id
            AND jtf.parent_territory_id = 1;
Line: 226

         SELECT territory_type_id
           FROM jtf_terr_all jtf
          WHERE jtf.terr_id = l_terr_id;
Line: 231

         SELECT olv.level_depth
           FROM ozf_terr_levels_all olv
          WHERE olv.heirarchy_id = p_hierarchy_id
            AND olv.terr_type_id = p_terr_type_id;
Line: 239

         SELECT DISTINCT creation_date
                        ,created_by
                        ,last_update_date
                        ,last_updated_by
                        ,last_update_login
                        ,program_application_id
                        ,program_id
                        ,program_update_date
                        ,request_id
                        ,territory_type_id
                        ,TO_NUMBER (LEVEL) level_depth
                        ,attribute_category
                        ,attribute1
                        ,attribute2
                        ,attribute3
                        ,attribute4
                        ,attribute5
                        ,attribute6
                        ,attribute7
                        ,attribute8
                        ,attribute9
                        ,attribute10
                        ,attribute11
                        ,attribute12
                        ,attribute13
                        ,attribute14
                        ,attribute15
                        ,org_id
                        ,terr_id
                        ,parent_territory_id
			-- Bug # 5723438 fixed by ateotia (+)
			,end_date_active
                        ,name
                        ,enabled_flag
			-- Bug # 5723438 fixed by ateotia (-)
                    FROM jtf_terr_all

      -- 07/13/2001 mpande removed the where condition instead put a error message so that the user sets the
      -- territory type properly
--     WHERE  TERRITORY_TYPE_ID is not null
              CONNECT BY parent_territory_id = PRIOR terr_id
              START WITH terr_id = l_start_node_id;
Line: 282

      SAVEPOINT insert_terr_levels;
Line: 296

      ozf_utility_pvt.write_conc_log('**********Start of Hierarchy Insert*******' );
Line: 353

            DELETE FROM ozf_terr_levels_all
                  WHERE heirarchy_id = l_terr_level_rec.terr_id;
Line: 367

	 -- Commented not to check for level_depth while insertion
         /* IF      l_terr_level IS NOT NULL
             AND l_terr_level <> l_terr_level_rec.level_depth THEN
            IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_error) THEN
               fnd_message.set_name ('OZF', 'OZF_TERR_TYPE_DUPLICATE_RECORD');
Line: 383

	 ozf_utility_pvt.write_conc_log('******* Insert into OZF Schema *******');
Line: 384

         INSERT INTO ozf_terr_levels_all
                     (terr_level_id
                     ,creation_date
                     ,created_by
                     ,last_update_date
                     ,last_updated_by
                     ,last_update_login
                     ,program_application_id
                     ,program_id
                     ,program_update_date
                     ,request_id
                     ,terr_type_id
                     ,level_depth
                     ,attribute1
                     ,attribute2
                     ,attribute3
                     ,attribute4
                     ,attribute5
                     ,attribute6
                     ,attribute7
                     ,attribute8
                     ,attribute9
                     ,attribute10
                     ,attribute11
                     ,attribute12
                     ,attribute13
                     ,attribute14
                     ,attribute15
                     ,org_id
                     ,territory_id
                     ,parent_territory_id
                     ,object_version_number
                     ,heirarchy_id
		     -- Bug # 5723438 fixed by ateotia (+)
                     ,hierarchy_name
		     ,end_date_active
                     ,enabled_flag
		     -- Bug # 5723438 fixed by ateotia (-)
                     )
              VALUES (l_terr_level_id
                     ,SYSDATE
                     ,fnd_global.user_id
                     ,SYSDATE
                     ,fnd_global.user_id
                     ,fnd_global.conc_login_id
                     ,l_terr_level_rec.program_application_id
                     ,l_terr_level_rec.program_id
                     ,l_terr_level_rec.program_update_date
                     ,l_terr_level_rec.request_id
                     ,l_terr_level_rec.territory_type_id
                     ,l_terr_level_rec.level_depth
                     ,l_terr_level_rec.attribute1
                     ,l_terr_level_rec.attribute2
                     ,l_terr_level_rec.attribute3
                     ,l_terr_level_rec.attribute4
                     ,l_terr_level_rec.attribute5
                     ,l_terr_level_rec.attribute6
                     ,l_terr_level_rec.attribute7
                     ,l_terr_level_rec.attribute8
                     ,l_terr_level_rec.attribute9
                     ,l_terr_level_rec.attribute10
                     ,l_terr_level_rec.attribute11
                     ,l_terr_level_rec.attribute12
                     ,l_terr_level_rec.attribute13
                     ,l_terr_level_rec.attribute14
                     ,l_terr_level_rec.attribute15
                     ,l_org_id
                     ,l_terr_level_rec.terr_id
                     ,l_terr_level_rec.parent_territory_id
                     ,1
                     ,p_start_node_id
		     -- Bug # 5723438 fixed by ateotia (+)
		     ,l_terr_level_rec.name
		     ,l_terr_level_rec.end_date_active
                     ,l_terr_level_rec.enabled_flag
		     -- Bug # 5723438 fixed by ateotia (-)
                     );
Line: 462

         ozf_utility_pvt.write_conc_log('******* Delete Duplicates *******');
Line: 464

	 DELETE from ozf_terr_levels_all
            WHERE active_flag = 'N'
            AND territory_id = l_terr_level_rec.terr_id
            AND parent_territory_id = l_terr_level_rec.parent_territory_id;
Line: 471

            l_insert_count             := SQL%ROWCOUNT;
Line: 492

         ROLLBACK TO insert_terr_levels;
Line: 500

         ROLLBACK TO insert_terr_levels;
Line: 508

         ROLLBACK TO insert_terr_levels;
Line: 520

   END insert_terr_levels;
Line: 532

   PROCEDURE bulk_insert_terr_levels (
      p_api_version        IN       NUMBER
     ,p_init_msg_list      IN       VARCHAR2 := fnd_api.g_false
     ,p_commit             IN       VARCHAR2 := fnd_api.g_false
     ,p_validation_level   IN       NUMBER := fnd_api.g_valid_level_full
     ,x_return_status      OUT NOCOPY      VARCHAR2
     ,x_msg_data           OUT NOCOPY      VARCHAR2
     ,x_msg_count          OUT NOCOPY      NUMBER
   ) IS
      l_api_name      CONSTANT VARCHAR2 (30)                 := 'bulk_insert_terr_levels';
Line: 551

        SELECT JTR.TERR_ID
        FROM JTF_TERR_ALL JTR , JTF_TERR_USGS_ALL JTU , JTF_SOURCES_ALL JSE
        WHERE  JTU.TERR_ID = JTR.TERR_ID
          AND JTU.SOURCE_ID = JSE.SOURCE_ID
          AND JTU.SOURCE_ID = -1003
          AND JTR.PARENT_TERRITORY_ID = 1
          AND NVL(JTR.ORG_ID, -99) = NVL(JTU.ORG_ID, NVL(JTR.ORG_ID, -99))
          AND JSE.ORG_ID IS NULL
          AND JTR.TERRITORY_TYPE_ID IS NOT NULL
          AND NVL(JTR.ORG_ID, NVL(TO_NUMBER(DECODE(SUBSTR(USERENV('CLIENT_INFO'),1,1),' ' , NULL, SUBSTR(USERENV('CLIENT_INFO'),1,10))),-99)) =
          NVL(TO_NUMBER(DECODE(SUBSTR(USERENV('CLIENT_INFO'),1,1),' ', NULL, SUBSTR(USERENV('CLIENT_INFO'),1,10))),-99);
Line: 568

             ozf_terr_levels_pvt.insert_terr_levels (
                    p_api_version        => 1.0
                   ,p_init_msg_list      => fnd_api.g_true
                   ,p_commit             => fnd_api.g_false
                   ,p_validation_level   => fnd_api.g_valid_level_full
                   ,x_return_status      => x_return_status
                   ,x_msg_data           => x_msg_data
                   ,x_msg_count          => x_msg_count
                   ,p_start_node_id      => l_terrIdTbl(i)
             );
Line: 579

                ozf_utility_pvt.write_conc_log('   /****** Failed to bulk insert level for hier id ' || l_terrIdTbl(i));
Line: 581

                ozf_utility_pvt.debug_message('   D: ' || l_api_name || '   successfully insert levels for terr id' || l_terrIdTbl(i));
Line: 587

   END bulk_insert_terr_levels;
Line: 599

   PROCEDURE delete_terr_levels (
      p_api_version        IN       NUMBER
     ,p_init_msg_list      IN       VARCHAR2 := fnd_api.g_false
     ,p_commit             IN       VARCHAR2 := fnd_api.g_false
     ,p_validation_level   IN       NUMBER := fnd_api.g_valid_level_full
     ,x_return_status      OUT NOCOPY      VARCHAR2
     ,x_msg_data           OUT NOCOPY      VARCHAR2
     ,x_msg_count          OUT NOCOPY      NUMBER
     ,p_hierarchy_id       IN       NUMBER
   ) IS
      l_api_name      CONSTANT VARCHAR2 (30)                 := 'Delete_terr_levels';
Line: 612

      l_insert_count           NUMBER;
Line: 621

 /* mpadne 07/13/2001 -- we will delete all records for that hierarhcy and recreate it
      CURSOR c_delete_terr (l_hierarchy_id IN NUMBER) IS
         SELECT *
           FROM ozf_terr_levels_all a
          WHERE a.heirarchy_id = l_hierarchy_id;
Line: 629

      SAVEPOINT delete_terr_levels;
Line: 644

      DELETE FROM ozf_terr_levels_all
            WHERE heirarchy_id = p_hierarchy_id;
Line: 648

       FOR l_terr_level_rec IN c_delete_terr (p_hierarchy_id)
       LOOP
          ozf_utility_pvt.debug_message (   l_full_name
                                         || ': begin');
Line: 653

          DELETE FROM ozf_terr_levels_all
                WHERE terr_level_id = l_terr_level_rec.terr_level_id;
Line: 671

         ROLLBACK TO delete_terr_levels;
Line: 679

         ROLLBACK TO delete_terr_levels;
Line: 687

         ROLLBACK TO delete_terr_levels;
Line: 699

   END delete_terr_levels;