DBA Data[Home] [Help]

APPS.HZ_GEOGRAPHY_PUB SQL Statements

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

Line: 44

FUNCTION multi_parent_update_val(
      l_geo_id           IN NUMBER,
	  l_element_col      IN VARCHAR2,
      l_element_col_type IN VARCHAR2 DEFAULT 'NAME'
	  ) RETURN VARCHAR2;
Line: 68

  FUNCTION multi_parent_update_val (l_geo_id NUMBER,  l_element_col VARCHAR2,
                                    l_element_col_type VARCHAR2 DEFAULT 'NAME')
    RETURN VARCHAR2 IS
    l_return_value VARCHAR2(100);
Line: 76

    SELECT country_code
    INTO   l_country_code
    FROM   hz_geographies
    WHERE  geography_id = l_geo_id;
Line: 81

	SELECT DECODE(l_element_col_type,'ID', geo_element_col||'_ID','CODE',
	       geo_element_col||'_CODE','NAME',geo_element_col,geo_element_col)
	INTO  l_return_value
	FROM (
	-- This select gives geography_element column name for those levels which
	-- are not multiple. For levels at which multiple parents exist, it returns null
	SELECT decode(no_of_parents, 1, DECODE(geo_temp.parent_object_type,'COUNTRY','GEOGRAPHY_ELEMENT1'
	       ,geo_struct.geography_element_column), NULL) geo_element_col, ROWNUM level_number,
	       geo_temp.parent_object_type geography_type
	FROM (
	     -- here grouping is based on number of parents at each level
	     SELECT COUNT(parent_object_type) no_of_parents , parent_object_type, level_number
	     FROM (
	           -- This query does the grouping based on parent id and geography type
	           -- Note : sysdate is not truncated in check because we want to not pick
	           -- up those records which are just now end dated (end dated in current flow)
	           SELECT  parent_id, parent_object_type, level_number
	           FROM   hz_hierarchy_nodes
	           WHERE  hierarchy_type = 'MASTER_REF'
	           AND    SYSDATE+0.0001 BETWEEN effective_start_date AND effective_end_date
	           AND    child_table_name = 'HZ_GEOGRAPHIES'
	           AND    NVL(status,'A') = 'A'
	           AND    child_id = l_geo_id
	           GROUP BY parent_id, parent_object_type, level_number
	         )
	    GROUP BY parent_object_type, level_number
	    ORDER BY level_number desc
	    ) geo_temp,
	      hz_geo_structure_levels geo_struct
	WHERE geo_temp.parent_object_type = DECODE(geo_temp.parent_object_type,
	                                          'COUNTRY',geo_struct.parent_geography_type,
											  geo_struct.geography_type)
	AND   country_code = l_country_code
	)
	WHERE geo_element_col = l_element_col;
Line: 123

  END multi_parent_update_val;
Line: 137

      SELECT parent_id,parent_object_type
        FROM HZ_HIERARCHY_NODES
       WHERE child_id = p_geography_id
         AND child_object_type = p_geography_type
         AND child_table_name = 'HZ_GEOGRAPHIES'
         AND hierarchy_type = 'MASTER_REF'
   	     AND NVL(status,'A') = 'A'
         AND (effective_end_date IS NULL
          OR effective_end_date > sysdate
          )
          ORDER BY level_number;
Line: 150

    SELECT geography_id, geography_name, geography_code
    FROM   hz_geographies
    WHERE  geography_type = 'COUNTRY'
    AND    geography_use = 'MASTER_REF'
    AND    country_code  = l_country_code
    AND    SYSDATE BETWEEN START_DATE AND end_date;
Line: 175

    SELECT country_code INTO l_country_code
    FROM hz_geographies
    WHERE geography_id= p_parent_geography_id;
Line: 190

               SELECT geography_element_column INTO l_geo_element_col
                 FROM HZ_GEO_STRUCTURE_LEVELS
                WHERE geography_type=l_get_all_parents.parent_object_type
                  AND country_code = l_country_code
                  AND rownum <2 ;
Line: 223

           SELECT geography_name,geography_code INTO l_geography_name,l_geography_code
           FROM HZ_GEOGRAPHIES
           WHERE geography_id=l_get_all_parents.parent_id;
Line: 227

		   -- check if this is a multi parent column. If it is then multi_parent_update_val will return NULL
		   -- otherwise it will return back the column name.
		   l_geo_element_col_temp :=  multi_parent_update_val(p_geography_id,l_geo_element_col,'NAME');
Line: 236

                EXECUTE IMMEDIATE 'UPDATE HZ_GEOGRAPHIES SET '||l_geo_element_col||'= :l_geography_name '||
                  ','||l_geo_element_id_col||'= :l_parent_id '||
                  ','||l_geo_element_code_col||'= :l_geography_code '||
                  ', multiple_parent_flag = ''N'''||
                  ' where geography_id = :l_geography_id '
				  USING l_geography_name, l_get_all_parents.parent_id,l_geography_code,p_geography_id;
Line: 244

               EXECUTE IMMEDIATE 'UPDATE HZ_GEOGRAPHIES SET '||l_geo_element_col||'= :l_geography_name '||
                  ','||l_geo_element_id_col||'= :l_parent_id '||
                  ', multiple_parent_flag = ''N'''||
                  ' where geography_id = :l_geography_id '
				  USING l_geography_name, to_char(l_get_all_parents.parent_id), to_char(p_geography_id);
Line: 251

           ELSE  -- its a multi parent record (update the flag to 'Y')
              UPDATE HZ_GEOGRAPHIES
              SET    multiple_parent_flag = 'Y'
              WHERE  geography_id = p_geography_id
              AND    multiple_parent_flag <> 'Y';
Line: 272

    SELECT child_id,child_object_type
      FROM HZ_HIERARCHY_NODES
     WHERE parent_id=p_geography_id
       AND parent_object_type=p_geography_type
       AND parent_table_name = 'HZ_GEOGRAPHIES'
       AND hierarchy_type='MASTER_REF'
	   AND NVL(status,'A') = 'A'
       AND (effective_end_date IS NULL
        OR effective_end_date > sysdate);
Line: 324

       SELECT distinct parent_object_type INTO l_parent_object_type
         FROM hz_hierarchy_nodes
        WHERE child_id = p_geography_id
          AND child_object_type=p_geography_type
          AND child_table_name = 'HZ_GEOGRAPHIES'
          AND hierarchy_type='MASTER_REF'
	      AND NVL(status,'A') = 'A'
          AND (effective_end_date IS NULL
              OR effective_end_date > sysdate)
          AND level_number = 1;
Line: 346

        SELECT distinct geography_element_column INTO l_geo_element_col
          FROM hz_geo_structure_levels
         WHERE geography_type = l_parent_object_type
           AND geography_id = (select geography_id from hz_geographies where country_code=
                              (select country_code from hz_geographies where geography_id=p_geography_id)
                                and geography_type = 'COUNTRY');  -- Bug4680789
Line: 368

    SELECT count(distinct parent_id) INTO l_count
      FROM hz_hierarchy_nodes
     WHERE child_id in ( SELECT parent_id
                         FROM hz_hierarchy_nodes
                        WHERE child_id = p_geography_id
                         AND child_object_type = p_geography_type
           		         AND child_table_name = 'HZ_GEOGRAPHIES'
         		         AND hierarchy_type = 'MASTER_REF'
         		         AND NVL(status,'A') = 'A'
         		         AND (effective_end_date IS NULL
                              OR effective_end_date > sysdate)
         		         AND parent_id <> child_id
         		         AND level_number = 1)
       AND child_table_name = 'HZ_GEOGRAPHIES'
       AND hierarchy_type='MASTER_REF'
       AND (effective_end_date IS NULL
           OR effective_end_date > sysdate)
       AND parent_id <> child_id
       AND level_number = 1;
Line: 405

		  l_geography_element2 := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT2','NAME');
Line: 406

		  l_geography_element3 := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT3','NAME');
Line: 407

		  l_geography_element4 := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT4','NAME');
Line: 408

		  l_geography_element5 := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT5','NAME');
Line: 409

		  l_geography_element6 := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT6','NAME');
Line: 410

		  l_geography_element7 := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT7','NAME');
Line: 411

		  l_geography_element8 := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT8','NAME');
Line: 412

		  l_geography_element9 := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT9','NAME');
Line: 413

		  l_geography_element10 := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT10','NAME');
Line: 414

		  l_geography_element2_id := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT2','ID');
Line: 415

		  l_geography_element3_id := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT3','ID');
Line: 416

		  l_geography_element4_id := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT4','ID');
Line: 417

		  l_geography_element5_id := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT5','ID');
Line: 418

		  l_geography_element6_id := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT6','ID');
Line: 419

		  l_geography_element7_id := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT7','ID');
Line: 420

		  l_geography_element8_id := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT8','ID');
Line: 421

		  l_geography_element9_id := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT9','ID');
Line: 422

		  l_geography_element10_id := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT10','ID');
Line: 423

		  l_geography_element2_code := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT2','CODE');
Line: 424

		  l_geography_element3_code := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT3','CODE');
Line: 425

		  l_geography_element4_code := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT4','CODE');
Line: 426

		  l_geography_element5_code := multi_parent_update_val(l_get_all_children.child_id,'GEOGRAPHY_ELEMENT5','CODE');
Line: 430

           UPDATE HZ_GEOGRAPHIES
           -- SET multiple_parent_flag = decode(geography_id,p_geography_id,'Y',multiple_parent_flag),
           SET multiple_parent_flag = 'Y',
             -- geography_element1=NULL,
               geography_element2= DECODE(l_geography_element2,NULL,NULL,geography_element2),
               geography_element3= DECODE(l_geography_element3,NULL,NULL,geography_element3),
               geography_element4= DECODE(l_geography_element4,NULL,NULL,geography_element4),
               geography_element5= DECODE(l_geography_element5,NULL,NULL,geography_element5),
               geography_element6= DECODE(l_geography_element6,NULL,NULL,geography_element6),
               geography_element7= DECODE(l_geography_element7,NULL,NULL,geography_element7),
               geography_element8= DECODE(l_geography_element8,NULL,NULL,geography_element8),
               geography_element9= DECODE(l_geography_element9,NULL,NULL,geography_element9),
               geography_element10= DECODE(l_geography_element10,NULL,NULL,geography_element10),
             --  geography_element1_id=NULL,
               geography_element2_id= DECODE(l_geography_element2_id,NULL,NULL,geography_element2_id),
               geography_element3_id= DECODE(l_geography_element3_id,NULL,NULL,geography_element3_id),
               geography_element4_id= DECODE(l_geography_element4_id,NULL,NULL,geography_element4_id),
               geography_element5_id= DECODE(l_geography_element5_id,NULL,NULL,geography_element5_id),
               geography_element6_id= DECODE(l_geography_element6_id,NULL,NULL,geography_element6_id),
               geography_element7_id= DECODE(l_geography_element7_id,NULL,NULL,geography_element7_id),
               geography_element8_id= DECODE(l_geography_element8_id,NULL,NULL,geography_element8_id),
               geography_element9_id= DECODE(l_geography_element9_id,NULL,NULL,geography_element9_id),
               geography_element10_id= DECODE(l_geography_element10_id,NULL,NULL,geography_element10_id),
             --  geography_element1_code = NULL,
               geography_element2_code = DECODE(l_geography_element2_code,NULL,NULL,geography_element2_code),
               geography_element3_code = DECODE(l_geography_element3_code,NULL,NULL,geography_element3_code),
               geography_element4_code = DECODE(l_geography_element4_code,NULL,NULL,geography_element4_code),
               geography_element5_code = DECODE(l_geography_element5_code,NULL,NULL,geography_element5_code)
            WHERE geography_id=l_get_all_children.child_id;
Line: 467

              EXECUTE IMMEDIATE 'UPDATE hz_geographies SET multiple_parent_flag='||'''Y'''||','||l_geo_element_col||' = NULL,'||
                             l_geo_element_col_id||' = NULL,'||l_geo_element_col_code||'= NULL where geography_id = '||l_get_all_children.child_id;
Line: 470

              EXECUTE IMMEDIATE 'UPDATE hz_geographies SET multiple_parent_flag='||'''Y'''||','||l_geo_element_col||' = NULL,'||
                             l_geo_element_col_id||' = NULL where geography_id = '||l_get_all_children.child_id;
Line: 497

   SELECT count(*) INTO l_count
     FROM hz_geography_identifiers
    WHERE identifier_type='NAME'
      AND identifier_subtype = p_child_identifier_subtype
      AND language_code = p_child_language
      AND UPPER(identifier_value) = UPPER(p_child_name)
      AND geography_id IN (SELECT object_id
                             FROM hz_relationships
                            WHERE subject_id = p_parent_id
                              AND object_type = p_child_type
                              AND status = 'A'
                              AND relationship_type = 'MASTER_REF');
Line: 541

   SELECT count(*) INTO l_count
     FROM hz_geography_identifiers
    WHERE identifier_type='CODE'
      AND identifier_subtype = p_child_identifier_subtype
      AND language_code = p_child_language
      AND identifier_value = UPPER(p_child_code)
      AND geography_id IN (SELECT object_id
                             FROM hz_relationships
                            WHERE subject_id = p_parent_id
                              AND object_type = p_child_type
                              AND status = 'A'
                              AND relationship_type = 'MASTER_REF');
Line: 635

      p_create_update_flag           =>  'C',
      x_return_status                =>  x_return_status
      );
Line: 664

     SELECT geography_name,geography_code,geography_type INTO
            l_geography_name,l_geography_code,l_geography_type
       FROM hz_geographies
      WHERE geography_id = p_master_relation_rec.geography_id;
Line: 685

          SELECT identifier_subtype,language_code INTO
                 l_identifier_subtype,l_language_code
            FROM hz_geography_identifiers
           WHERE geography_id = p_master_relation_rec.geography_id
             AND identifier_type = 'NAME'
             AND primary_flag = 'Y'
             AND geography_use = 'MASTER_REF';
Line: 721

         SELECT identifier_subtype,language_code INTO
                l_identifier_subtype,l_language_code
           FROM hz_geography_identifiers
          WHERE geography_id = p_master_relation_rec.geography_id
            AND identifier_type = 'CODE'
            AND primary_flag = 'Y'
            AND geography_use = 'MASTER_REF';
Line: 760

       SELECT count(*) INTO l_count FROM HZ_HIERARCHY_NODES
        WHERE hierarchy_type='MASTER_REF'
          AND child_id=p_master_relation_rec.geography_id
          AND parent_object_type='COUNTRY'
          AND NVL(status,'A') = 'A'
          AND level_number = 1;
Line: 816

     SELECT count(subject_id) INTO l_parent_count
       FROM HZ_RELATIONSHIPS
      WHERE object_id = p_master_relation_rec.geography_id
        AND object_type=l_geography_type
        AND object_table_name='HZ_GEOGRAPHIES'
        AND subject_table_name = 'HZ_GEOGRAPHIES'
        AND relationship_type='MASTER_REF'
        AND relationship_code = 'PARENT_OF'
        AND status = 'A'
        AND rownum <3;
Line: 863

 |              Updates a relation between master geographies
 |
 | SCOPE - PRIVATE
 |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED
 |
 | ARGUMENTS  : IN:
 |
 |                    p_master_relation_rec
 |                    p_object_version_number
 |              OUT:
 |
 |                    x_return_status
 |
 |          IN/ OUT:
 |
 | RETURNS    : NONE
 |
 | NOTES
 |
 | MODIFICATION HISTORY
 |          11-22-02            o Rekha Nalluri created.
 |          12-14-12            o Nishant Singhai Modified cursor c_get_all_children
 |                                for bug 14705367
 |
 +===========================================================================*/

 PROCEDURE do_update_relationship(
        p_relationship_id               IN NUMBER,
        p_status                        IN VARCHAR2,
        p_object_version_number         IN OUT NOCOPY NUMBER,
        x_return_status                 IN OUT NOCOPY VARCHAR2
       ) IS

       l_relationship_rec               HZ_RELATIONSHIP_V2PUB.relationship_rec_type;
Line: 903

       l_update_flag                     VARCHAR2(1);
Line: 912

         SELECT child_id, child_object_type
           FROM hz_hierarchy_nodes
          WHERE hierarchy_type='MASTER_REF'
            AND parent_id=l_geography_id
            AND child_table_name = 'HZ_GEOGRAPHIES'
            AND NVL(status,'A') = 'A'
            AND (effective_end_date IS NULL
            OR effective_end_date > sysdate)
            ;
Line: 930

          p_create_update_flag     => 'U',
          p_column                 => 'object_version_number',
          p_column_value           => p_object_version_number,
          x_return_status          => x_return_status
          );
Line: 942

      SELECT subject_id,object_id,relationship_type into l_parent_geography_id,l_geography_id,l_relationship_type
      FROM hz_relationships
     WHERE relationship_id = p_relationship_id
       AND relationship_code = 'PARENT_OF';
Line: 983

      HZ_RELATIONSHIP_V2PUB.update_relationship(
    p_init_msg_list               =>'F',
    p_relationship_rec            =>     l_relationship_rec,
    p_object_version_number       =>     p_object_version_number,
    p_party_object_version_number =>     l_party_object_version_number,
    x_return_status               =>     x_return_status,
    x_msg_count                   =>     x_msg_count,
    x_msg_data                    =>     x_msg_data
);
Line: 998

     SELECT count(subject_id) INTO l_parent_count
       FROM HZ_RELATIONSHIPS
      WHERE object_id = l_geography_id
        AND object_type=l_geography_type
        AND object_table_name='HZ_GEOGRAPHIES'
        AND subject_table_name = 'HZ_GEOGRAPHIES'
        AND relationship_type='MASTER_REF'
        AND relationship_code = 'PARENT_OF'
        AND status = 'A';
Line: 1029

        l_update_flag := 'Y';
Line: 1032

          l_update_flag := 'Y';
Line: 1035

           l_update_flag := 'Y';
Line: 1040

  IF l_update_flag = 'Y' THEN
    -- call relationship API for update
    HZ_RELATIONSHIP_V2PUB.update_relationship(
    p_init_msg_list               =>'F',
    p_relationship_rec            =>     l_relationship_rec,
    p_object_version_number       =>     p_object_version_number,
    p_party_object_version_number =>     l_party_object_version_number,
    x_return_status               =>     x_return_status,
    x_msg_count                   =>     x_msg_count,
    x_msg_data                    =>     x_msg_data
);
Line: 1063

    UPDATE hz_geographies
       SET multiple_parent_flag = 'N'
     WHERE geography_id = l_geography_id;
Line: 1088

     UPDATE hz_geographies
        SET multiple_parent_flag = 'Y'
      WHERE geography_id = l_geography_id;
Line: 1097

END do_update_relationship;
Line: 1147

     SELECT subject_id
       FROM hz_relationships
      WHERE object_id = p_geo_identifier_rec.geography_id
        AND relationship_type = 'MASTER_REF'
        AND status = 'A';
Line: 1183

      p_create_update_flag     => 'C',
      x_return_status          => x_return_status
      );
Line: 1197

       SELECT geography_use,geography_type INTO l_geography_use,l_geography_type
         FROM HZ_GEOGRAPHIES
        WHERE geography_id = p_geo_identifier_rec.geography_id;
Line: 1248

           SELECT count(*) INTO l_count
            FROM  hz_geography_identifiers
            WHERE  identifier_type = p_geo_identifier_rec.identifier_type
            AND  identifier_subtype = l_identifier_subtype
            AND  language_code = p_geo_identifier_rec.language_code
            AND  UPPER(identifier_value) = UPPER(p_geo_identifier_rec.identifier_value)
            AND  geography_type = 'COUNTRY';
Line: 1283

       SELECT count(*) INTO l_count from
              hz_geography_identifiers
          WHERE geography_id = p_geo_identifier_rec.geography_id
            AND language_code = l_language_code;
Line: 1296

          SELECT count(*) INTO l_count
            FROM hz_geography_identifiers
           WHERE geography_id = p_geo_identifier_rec.geography_id
             AND identifier_type = 'NAME'
             AND identifier_subtype = 'STANDARD_NAME'
             AND primary_flag = 'Y'
             AND language_code = l_language_code;
Line: 1306

           UPDATE hz_geography_identifiers
              SET primary_flag = 'N'
            WHERE geography_id = p_geo_identifier_rec.geography_id
              AND identifier_type = 'NAME'
              AND identifier_subtype = 'STANDARD_NAME'
              AND primary_flag = 'Y'
              AND language_code = l_language_code;
Line: 1319

       SELECT count(*) INTO l_count
         FROM HZ_GEOGRAPHY_IDENTIFIERS
        WHERE geography_id = p_geo_identifier_rec.geography_id
          AND identifier_type = p_geo_identifier_rec.identifier_type
          AND primary_flag='Y';
Line: 1327

          UPDATE hz_geography_identifiers
             SET primary_flag = 'N'
           WHERE geography_id=p_geo_identifier_rec.geography_id
             AND identifier_type = p_geo_identifier_rec.identifier_type
             AND primary_flag = 'Y';
Line: 1340

   HZ_GEOGRAPHY_IDENTIFIERS_PKG.insert_row(
    x_rowid                                 =>  l_rowid,
    x_geography_id                          =>  p_geo_identifier_rec.geography_id,
    x_identifier_subtype                    =>  l_identifier_subtype,
    x_identifier_value                      =>  l_identifier_value,
    x_geo_data_provider                     =>  p_geo_identifier_rec.geo_data_provider,
    x_object_version_number                 =>  1,
    x_identifier_type                       =>  p_geo_identifier_rec.identifier_type,
    x_primary_flag                          =>  p_geo_identifier_rec.primary_flag,
    x_language_code                         =>  UPPER(l_language_code),
    x_geography_use                         =>  l_geography_use,
    x_geography_type                        =>  UPPER(l_geography_type),
    x_created_by_module                     =>  p_geo_identifier_rec.created_by_module,
    x_application_id                        =>  p_geo_identifier_rec.application_id,
    x_program_login_id                      => NULL
        );
Line: 1364

     SELECT distinct geography_element_column,country_code
     INTO l_geo_element_col,l_country_code
      FROM HZ_GEO_STRUCTURE_LEVELS
     WHERE geography_id = (SELECT geography_id FROM
                           HZ_GEOGRAPHIES WHERE COUNTRY_CODE=(SELECT country_code from hz_geographies
                                                                 WHERE geography_id = l_geography_id)
                                            AND geography_type='COUNTRY')
       AND geography_type = l_geography_type;
Line: 1394

    UPDATE HZ_GEOGRAPHIES
       SET geography_code = p_geo_identifier_rec.identifier_value,
           country_code = p_geo_identifier_rec.identifier_value
     WHERE geography_id = p_geo_identifier_rec.geography_id;
Line: 1401

      UPDATE HZ_GEOGRAPHIES
--  Bug 4579868 : ISSUE # 11
--  denormalize upper code and not identifier_value directly
--       SET geography_code = p_geo_identifier_rec.identifier_value
       SET geography_code = l_identifier_value,
               last_updated_by  = hz_utility_pub.LAST_UPDATED_BY,
               last_update_date = hz_utility_pub.LAST_UPDATE_DATE
     WHERE geography_id = p_geo_identifier_rec.geography_id;
Line: 1414

     EXECUTE IMMEDIATE 'UPDATE HZ_GEOGRAPHIES SET '||l_geo_element_code||'= :l_identifier_value '||
                 ' WHERE country_code= :l_country_code '||
                 ' AND '||l_geo_element_id||'= :l_geography_id '
				 USING l_identifier_value, l_country_code, l_geography_id;
Line: 1429

     UPDATE HZ_GEOGRAPHIES
        SET geography_name = p_geo_identifier_rec.identifier_value,
               last_updated_by  = hz_utility_pub.LAST_UPDATED_BY,
               last_update_date = hz_utility_pub.LAST_UPDATE_DATE
      WHERE geography_id = p_geo_identifier_rec.geography_id;
Line: 1435

      EXECUTE IMMEDIATE 'UPDATE HZ_GEOGRAPHIES SET '||l_geo_element_col||'= :l_identifier_value '||
                 ' WHERE country_code= :l_country_code '||
                 ' AND '||l_geo_element_id||'= :l_geography_id '
				 USING l_identifier_value, l_country_code, l_geography_id;
Line: 1451

 PROCEDURE do_update_geo_identifier(
        p_geo_identifier_rec            IN GEO_IDENTIFIER_REC_TYPE,
        p_object_version_number         IN OUT NOCOPY NUMBER,
        x_cp_request_id                 OUT    NOCOPY   NUMBER,
        x_return_status                 IN OUT NOCOPY VARCHAR2
       )IS

       l_count         NUMBER;
Line: 1473

       l_subtype_updated VARCHAR2(1);
Line: 1474

       l_name_updated    VARCHAR2(1);
Line: 1477

        SELECT subject_id
        FROM   hz_relationships
        WHERE  object_id = p_geo_identifier_rec.geography_id
          AND  object_table_name = 'HZ_GEOGRAPHIES'
          AND  relationship_type = 'MASTER_REF'
          AND  status = 'A';
Line: 1492

         p_create_update_flag     => 'U',
         x_return_status         => x_return_status
         );
Line: 1501

          p_create_update_flag     => 'U',
          p_column                 => 'object_version_number',
          p_column_value           => p_object_version_number,
          x_return_status          => x_return_status
          );
Line: 1512

	       SELECT rowid,geography_type,geography_use,primary_flag,object_version_number
	       INTO l_rowid,l_geography_type,l_geography_use,l_old_primary_flag,l_object_version_number
	       FROM hz_geography_identifiers
	       WHERE geography_id = p_geo_identifier_rec.geography_id
	         AND identifier_type = p_geo_identifier_rec.identifier_type
	         AND identifier_subtype = p_geo_identifier_rec.identifier_subtype
	         AND identifier_value = p_geo_identifier_rec.identifier_value
	         AND language_code = p_geo_identifier_rec.language_code
	         FOR UPDATE of geography_id NOWAIT;
Line: 1556

           l_subtype_updated := 'Y';
Line: 1557

		 ELSE -- new geo subtype is null (i.e. no need to update), use the old subtype
		   l_new_geo_subtype :=  l_geo_identifier_subtype;
Line: 1559

		   l_subtype_updated := 'N';
Line: 1572

           l_subtype_updated := 'Y';
Line: 1573

	     ELSE -- new geo subtype is null (i.e. no need to update), use the old subtype
		   l_new_geo_subtype :=  l_geo_identifier_subtype;
Line: 1575

		   l_subtype_updated := 'N';
Line: 1586

         l_name_updated := 'Y';
Line: 1587

       ELSE -- not to be updated, so retain the old value
         l_new_geo_value := p_geo_identifier_rec.identifier_value;
Line: 1589

         l_name_updated := 'N';
Line: 1593

        IF (l_name_updated = 'Y') THEN
	  	   IF l_geography_use = 'MASTER_REF' THEN
                    IF l_geography_type <> 'COUNTRY' THEN
	        -- check for the duplicate name/code with in the parents of the geography
	        OPEN c_get_all_parents;
Line: 1604

			   SELECT count(*) INTO l_count
			     FROM hz_geography_identifiers
			    WHERE identifier_type='NAME'
			      AND identifier_subtype = l_new_geo_subtype
			      AND language_code = p_geo_identifier_rec.language_code
			      AND UPPER(identifier_value) = UPPER(l_new_geo_value)
			      AND geography_id IN (SELECT object_id
			                             FROM hz_relationships
			                            WHERE subject_id = l_get_all_parents.subject_id
			                              AND object_type = l_geography_type
			                              AND status = 'A'
			                              AND relationship_type = 'MASTER_REF')
				  AND ROWID <> l_rowid ;
Line: 1633

			    SELECT count(*) INTO l_count
			     FROM hz_geography_identifiers
			    WHERE identifier_type='CODE'
			      AND identifier_subtype = l_new_geo_subtype
			      AND language_code = p_geo_identifier_rec.language_code
			      AND identifier_value = UPPER(l_new_geo_value)
			      AND geography_id IN (SELECT object_id
			                             FROM hz_relationships
			                            WHERE subject_id = l_get_all_parents.subject_id
			                              AND object_type = l_geography_type
			                              AND status = 'A'
			                              AND relationship_type = 'MASTER_REF')
				  AND ROWID <> l_rowid ;
Line: 1664

                 SELECT count(*) INTO l_count
                  FROM  hz_geography_identifiers
                 WHERE  identifier_type = p_geo_identifier_rec.identifier_type
                   AND  identifier_subtype = l_new_geo_subtype
                   AND  language_code = p_geo_identifier_rec.language_code
                   AND  UPPER(identifier_value) = UPPER(l_new_geo_value)
                   AND  geography_type = 'COUNTRY'
                   AND  rowid <> l_rowid;
Line: 1688

         FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_NONUPDATEABLE_COLUMN' );
Line: 1699

	      SELECT count(*) INTO l_count
	        FROM HZ_GEOGRAPHY_IDENTIFIERS
	       WHERE geography_id = p_geo_identifier_rec.geography_id
	         AND identifier_type = p_geo_identifier_rec.identifier_type
	         AND primary_flag='Y'
			 AND language_code = p_geo_identifier_rec.language_code;
Line: 1709

	          UPDATE hz_geography_identifiers
	             SET primary_flag = 'N'
	           WHERE geography_id=p_geo_identifier_rec.geography_id
	             AND identifier_type = p_geo_identifier_rec.identifier_type
	             AND primary_flag = 'Y'
				 AND language_code = p_geo_identifier_rec.language_code;
Line: 1715

	        -- --dbms_output.put_line ( 'After update of primary from Y to N');
Line: 1719

     hz_geography_identifiers_pkg.update_row(
	    x_rowid                          => l_rowid,
	    x_geography_id                   => p_geo_identifier_rec.geography_id,
	    x_identifier_subtype             => l_new_geo_subtype,
	    x_identifier_value               => l_new_geo_value,
	    x_geo_data_provider              => p_geo_identifier_rec.geo_data_provider,
	    x_object_version_number          => p_object_version_number,
	    x_identifier_type                => p_geo_identifier_rec.identifier_type,
	    x_primary_flag                   => p_geo_identifier_rec.primary_flag,
	    x_language_code                  => p_geo_identifier_rec.language_code,
	    x_geography_use                  => NULL,
	    x_geography_type                 => NULL,
	    x_created_by_module              => NULL,
	    x_application_id                 => NULL,
	    x_program_login_id               => NULL);
Line: 1740

         (l_name_updated = 'Y'))
       )
      )
   THEN
     x_cp_request_id :=   fnd_request.submit_request(
                                      application => 'AR',
                                      program     => 'ARHGEOEU',
                                      argument1   => p_geo_identifier_rec.geography_id,
                                      argument2   => p_geo_identifier_rec.identifier_type,
									  argument3   => l_new_geo_value);
Line: 1753

            (l_name_updated = 'Y'))
          )
         )
    THEN
      -- (For TAX, Logic added by Nishant on 27-Oct-2005 for Bug 4578867)
      -- FOR geography_use = 'TAX' we dont have any hierarchy (structure),
      -- so coulmns geography_element1,geography_element1_name,geography_element1_code...
      -- are all null.and the only columns which need to be modified in hz_geographies
      -- are geography_name and geography_code

      IF p_geo_identifier_rec.identifier_type = 'CODE' THEN
        UPDATE HZ_GEOGRAPHIES
           SET geography_code = l_new_geo_value,
               last_updated_by  = hz_utility_pub.LAST_UPDATED_BY,
               last_update_date = hz_utility_pub.LAST_UPDATE_DATE
         WHERE geography_id = p_geo_identifier_rec.geography_id
		   AND geography_use = l_geography_use;
Line: 1773

        UPDATE HZ_GEOGRAPHIES
           SET geography_name = l_new_geo_value,
               last_updated_by  = hz_utility_pub.LAST_UPDATED_BY,
               last_update_date = hz_utility_pub.LAST_UPDATE_DATE
         WHERE geography_id = p_geo_identifier_rec.geography_id
		   AND geography_use = l_geography_use;
Line: 1782

 END do_update_geo_identifier;
Line: 1785

   PROCEDURE do_delete_geo_identifier(
        p_geography_id                 IN NUMBER,
        p_identifier_type              IN VARCHAR2,
        p_identifier_subtype           IN VARCHAR2,
        p_identifier_value             IN VARCHAR2,
        p_language_code                IN VARCHAR2,
        x_return_status                IN OUT NOCOPY VARCHAR2
       ) IS

       l_primary_flag         VARCHAR2(1);
Line: 1796

       l_delete_flag          VARCHAR2(1);
Line: 1800

        l_delete_flag := 'Y';
Line: 1803

        SELECT primary_flag INTO l_primary_flag
          FROM hz_geography_identifiers
         WHERE geography_id = p_geography_id
           AND identifier_type = p_identifier_type
           AND identifier_subtype = p_identifier_subtype
           AND identifier_value = p_identifier_value
           AND language_code = p_language_code;
Line: 1812

            l_delete_flag := 'N';
Line: 1813

            FND_MESSAGE.SET_NAME( 'AR', 'HZ_GEO_NONDELETEABLE' );
Line: 1822

             select count(*) INTO l_count
               from hz_geography_identifiers
              where geography_id = p_geography_id
                AND language_code = p_language_code
                AND identifier_type = 'NAME'
                ;
Line: 1830

                 UPDATE hz_geography_identifiers
                    SET identifier_subtype = 'STANDARD_NAME'
                  WHERE geography_id = p_geography_id
                    AND identifier_type= p_identifier_type
                    AND identifier_subtype <> p_identifier_subtype
                    AND identifier_value <> p_identifier_value
                    AND language_code = p_language_code
                    AND rownum < 2;
Line: 1838

                 l_delete_flag := 'Y';
Line: 1840

                 l_delete_flag := 'Y';
Line: 1844

            IF l_delete_flag = 'Y' THEN
           HZ_GEOGRAPHY_IDENTIFIERS_PKG.delete_row(
               x_geography_id                => p_geography_id,
    	       x_identifier_subtype          => p_identifier_subtype,
               x_identifier_value            => p_identifier_value,
               x_language_code               => p_language_code,
               x_identifier_type             => p_identifier_type
               );
Line: 1863

END do_delete_geo_identifier;
Line: 1895

         p_create_update_flag     => 'C',
         x_return_status          => x_return_status
         );
Line: 1909

        SELECT country_code INTO l_country_code
          FROM HZ_GEOGRAPHIES
         WHERE geography_id= l_parent_geography_tbl(1);
Line: 1916

    HZ_GEOGRAPHIES_PKG.insert_row(
    x_rowid                                 => l_rowid,
    x_geography_id                          => x_geography_id,
    x_object_version_number                  => 1,
    x_geography_type                        => UPPER(p_master_geography_rec.geography_type),
    x_geography_name                        => p_master_geography_rec.geography_name,
    x_geography_use                         => 'MASTER_REF',
    x_geography_code                        => UPPER(p_master_geography_rec.geography_code),
    x_start_date                            => p_master_geography_rec.start_date,
    x_end_date                              => p_master_geography_rec.end_date,
    x_multiple_parent_flag                  => 'N',
    x_created_by_module                     => p_master_geography_rec.created_by_module,
    x_country_code                          => l_country_code,
    x_geography_element1                    => NULL,
    x_geography_element1_id                 => NULL,
    x_geography_element1_code               => NULL,
    x_geography_element2                    => NULL,
    x_geography_element2_id                 => NULL,
    x_geography_element2_code               => NULL,
    x_geography_element3                    => NULL,
    x_geography_element3_id                 => NULL,
    x_geography_element3_code               => NULL,
    x_geography_element4                    => NULL,
    x_geography_element4_id                 => NULL,
    x_geography_element4_code               => NULL,
    x_geography_element5                    => NULL,
    x_geography_element5_id                 => NULL,
    x_geography_element5_code               => NULL,
    x_geography_element6                    => NULL,
    x_geography_element6_id                 => NULL,
    x_geography_element7                    => NULL,
    x_geography_element7_id                 => NULL,
    x_geography_element8                    => NULL,
    x_geography_element8_id                 => NULL,
    x_geography_element9                    => NULL,
    x_geography_element9_id                 => NULL,
    x_geography_element10                   => NULL,
    x_geography_element10_id                => NULL,
    x_geometry                              => p_master_geography_rec.geometry,
    x_timezone_code                         => p_master_geography_rec.timezone_code,
    x_application_id                        => p_master_geography_rec.application_id,
    x_program_login_id                      => 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,
    x_attribute16                           => NULL,
    x_attribute17                           => NULL,
    x_attribute18                           => NULL,
    x_attribute19                           => NULL,
    x_attribute20                           => NULL
   );
Line: 2073

PROCEDURE do_update_geography(
  	p_geography_id                 IN NUMBER,
        p_end_date                     IN DATE,
        p_geometry                     IN MDSYS.SDO_GEOMETRY,
        p_timezone_code                IN VARCHAR2,
        p_object_version_number        IN OUT NOCOPY NUMBER,
        x_return_status                IN OUT  NOCOPY VARCHAR2
        ) IS

      l_rowid                         VARCHAR2(64);
Line: 2092

      SELECT  distinct relationship_id,object_version_number
        FROM HZ_RELATIONSHIPS
       WHERE (subject_id = p_geography_id
          OR object_id = p_geography_id)
         AND relationship_type= l_geography_use
         AND l_geography_use = 'MASTER_REF'  --Bug5265511
         AND status = 'A';                   --Bug5454824
Line: 2111

          p_create_update_flag     => 'U',
          p_column                 => 'object_version_number',
          p_column_value           => p_object_version_number,
          x_return_status          => x_return_status
          );
Line: 2124

     SELECT rowid,start_date,end_date,geography_use,object_version_number INTO l_rowid,l_start_date,l_end_date,
                       l_geography_use,l_object_version_number
       FROM HZ_GEOGRAPHIES
      WHERE geography_id=p_geography_id
       FOR UPDATE of geography_id NOWAIT;
Line: 2151

           p_create_update_flag                    => 'U',
    	   p_start_date_column_name                => 'start_date',
           p_start_date                            => l_start_date,
           p_old_start_date                        => l_start_date,
           p_end_date_column_name                  => 'end_date',
           p_end_date                              => p_end_date,
           p_old_end_date                          => l_end_date,
           x_return_status                         => x_return_status
           );
Line: 2175

      SELECT count(*) INTO l_count
        FROM FND_TIMEZONES_B
       WHERE timezone_code = p_timezone_code
        AND  rownum <2;
Line: 2192

    HZ_GEOGRAPHIES_PKG.update_row(
    x_rowid                                 => l_rowid,
    x_geography_id                          => p_geography_id,
    x_object_version_number                 => p_object_version_number,
    x_geography_type                        => NULL,
    x_geography_name                        => NULL,
    x_geography_use                         => NULL,
    x_geography_code                        => NULL,
    x_start_date                            => NULL,
    x_end_date                              => l_end_date,
    x_multiple_parent_flag                  => NULL,
    x_created_by_module                     => NULL,
    x_country_code                          => NULL,
    x_geography_element1                    => NULL,
    x_geography_element1_id                 => NULL,
    x_geography_element1_code               => NULL,
    x_geography_element2                    => NULL,
    x_geography_element2_id                 => NULL,
    x_geography_element2_code               => NULL,
    x_geography_element3                    => NULL,
    x_geography_element3_id                 => NULL,
    x_geography_element3_code               => NULL,
    x_geography_element4                    => NULL,
    x_geography_element4_id                 => NULL,
    x_geography_element4_code               => NULL,
    x_geography_element5                    => NULL,
    x_geography_element5_id                 => NULL,
    x_geography_element5_code               => NULL,
    x_geography_element6                    => NULL,
    x_geography_element6_id                 => NULL,
    x_geography_element7                    => NULL,
    x_geography_element7_id                 => NULL,
    x_geography_element8                    => NULL,
    x_geography_element8_id                 => NULL,
    x_geography_element9                    => NULL,
    x_geography_element9_id                 => NULL,
    x_geography_element10                   => NULL,
    x_geography_element10_id                => NULL,
    x_geometry                              => p_geometry,
    x_timezone_code                         => p_timezone_code,
    x_application_id                        => NULL,
    x_program_login_id                      => 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,
    x_attribute16                           => NULL,
    x_attribute17                           => NULL,
    x_attribute18                           => NULL,
    x_attribute19                           => NULL,
    x_attribute20                           => NULL
    );
Line: 2284

        HZ_RELATIONSHIP_V2PUB.update_relationship(
    p_init_msg_list               =>     'F',
    p_relationship_rec            =>     l_relationship_rec,
    p_object_version_number       =>     l_get_all_relationships.object_version_number,
    p_party_object_version_number =>     l_party_object_version_number,
    x_return_status               =>     x_return_status,
    x_msg_count                   =>     x_msg_count,
    x_msg_data                    =>     x_msg_data
);
Line: 2294

    /* update hz_relationships
         set status = l_status,
             end_date = p_end_date
       WHERE relationship_id=l_get_all_relationships.relationship_id;*/
Line: 2308

    /* update hz_hierarchy_nodes
          set effective_end_date = p_end_date
        where hierarchy_type=l_geography_use
          and parent_id = p_geography_id
           or child_id = p_geography_id ; */
Line: 2315

END do_update_geography;
Line: 2361

	        SELECT geography_type, country_code
	        INTO   l_parent_geo_type, l_country_code
	        FROM   hz_geographies
	        WHERE  geography_id = l_geography_range_rec.master_ref_geography_id
	  	    AND    geography_use = 'MASTER_REF'
		    AND    TRUNC(SYSDATE) BETWEEN START_DATE AND end_date
		    ;
Line: 2375

	  	  	  SELECT st.geography_type
			  INTO   l_child_geo_type
			  FROM   hz_geo_structure_levels st
			        ,hz_geography_types_b tp
	 	   	  WHERE  st.country_code = l_country_code
			  AND    st.parent_geography_type = l_parent_geo_type
			  AND    st.geography_type = tp.geography_type
			  AND    tp.geography_use = 'MASTER_REF'
			  AND    tp.postal_code_range_flag = 'Y'
			  AND    tp.geography_use = 'MASTER_REF'
			  AND    ROWNUM < 2
			  ;
Line: 2406

		            SELECT COUNT(*)
		            INTO   l_count
					FROM   hz_geography_identifiers id
					WHERE  UPPER(id.identifier_value) = l_master_geography_rec.geography_name
					AND    id.geography_use = 'MASTER_REF'
					AND    id.identifier_type = 'NAME'
					AND    id.identifier_subtype = 'STANDARD_NAME'
					AND    EXISTS ( SELECT '1'
					                FROM  hz_relationships rel
					                WHERE rel.subject_id = l_geography_range_rec.master_ref_geography_id
					                AND   rel.object_id = id.geography_id
					                AND   rel.object_type = l_master_geography_rec.geography_type
					                AND   rel.status = 'A'
					                AND   rel.relationship_type = 'MASTER_REF');
Line: 2485

   /*SELECT count(*) INTO l_count from hz_geography_ranges
    WHERE geography_id =   p_geography_range_rec.zone_id
      AND geography_from = p_geography_range_rec.geography_from
      AND to_char(start_date,'DD-MON-YYYY') = to_char(p_geography_range_rec.start_date,'DD_MON-YYYY');
Line: 2501

      p_create_update_flag         => 'C',
      x_return_status              => x_return_status
        );
Line: 2514

    SELECT geography_use INTO l_geography_use
      FROM hz_geography_types_b
     WHERE geography_type=l_zone_type;
Line: 2518

     hz_geography_ranges_pkg.insert_row (
    x_rowid                                 => l_rowid,
    x_geography_id                          => p_geography_range_rec.zone_id,
    x_geography_from                        => p_geography_range_rec.geography_from,
    x_start_date                            => p_geography_range_rec.start_date,
    x_object_version_number                 => 1,
    x_geography_to                          => p_geography_range_rec.geography_to,
    x_identifier_type                       => p_geography_range_rec.identifier_type,
    x_end_date                              => p_geography_range_rec.end_date,
--  Dhaval : Use queried geography_type
    x_geography_type                        => l_zone_type,
    x_geography_use                         => l_geography_use,
    x_master_ref_geography_id               => p_geography_range_rec.master_ref_geography_id,
    x_created_by_module                     => p_geography_range_rec.created_by_module,
    x_application_id                        => p_geography_range_rec.application_id,
    x_program_login_id                      => NULL
          );
Line: 2548

PROCEDURE do_update_geography_range(
        p_geography_id                  IN NUMBER,
        p_geography_from                IN VARCHAR2,
        p_start_date                    IN DATE,
        p_end_date                      IN DATE,
        p_object_version_number         IN OUT NOCOPY NUMBER,
        x_return_status                 IN OUT NOCOPY VARCHAR2
       ) IS

   l_rowid        ROWID;
Line: 2572

        p_create_update_flag  => 'U',
        x_return_status       => x_return_status
        );
Line: 2581

          p_create_update_flag     => 'U',
          p_column                 => 'object_version_number',
          p_column_value           => p_object_version_number,
          x_return_status          => x_return_status
          );
Line: 2594

     SELECT rowid,start_date,end_date,object_version_number  INTO l_rowid,l_start_date,l_end_date,l_object_version_number
       FROM hz_geography_ranges
      WHERE geography_id = p_geography_id
        AND geography_from = p_geography_from
        AND start_date = p_start_date
        FOR UPDATE OF geography_id,geography_from,start_date NOWAIT;
Line: 2622

           p_create_update_flag                    => 'U',
           p_start_date_column_name                => 'start_date',
           p_start_date                            => p_start_date,
           p_old_start_date                        => l_start_date,
           p_end_date_column_name                  => 'end_date',
           p_end_date                              => p_end_date,
           p_old_end_date                          => l_end_date,
           x_return_status                         => x_return_status
           );
Line: 2637

        HZ_GEOGRAPHY_RANGES_PKG.update_row(
               	 x_rowid                         => l_rowid,
    		 x_geography_id                  => p_geography_id,
    		 x_geography_from                => p_geography_from,
    		 x_start_date                    => p_start_date,
   		 x_object_version_number         => p_object_version_number,
   		 x_geography_to                  => NULL,
   		 x_identifier_type               => NULL,
   		 x_end_date                      => p_end_date,
    		 x_geography_type                => NULL,
    		 x_geography_use                 => NULL,
    		 x_master_ref_geography_id       => NULL,
   		 x_created_by_module             => NULL,
   		 x_application_id                => NULL,
   		 x_program_login_id              => NULL
   		   		 );
Line: 2654

END do_update_geography_range;
Line: 2697

       SELECT geography_use,limited_by_geography_id INTO l_geography_use,l_limited_by_geography_id
         FROM hz_geography_types_b
        WHERE geography_type = l_zone_type;
Line: 2712

         p_create_update_flag  => 'C',
         x_return_status       => x_return_status
         );
Line: 2735

            SELECT 1 INTO l_count
        FROM hz_hierarchy_nodes
       WHERE parent_id = l_limited_by_geography_id
         AND child_id  = p_zone_relation_tbl(i).included_geography_id
         AND hierarchy_type = 'MASTER_REF'
      	 AND NVL(status,'A') = 'A'
         AND (effective_end_date IS NULL
          OR effective_end_date > sysdate
          )
         AND rownum < 2;
Line: 2760

        SELECT count(*) INTO l_COUNT
         FROM HZ_RELATIONSHIP_TYPES
        WHERE subject_type = l_zone_type
          AND object_type= l_incl_geo_type
          AND forward_rel_code = 'PARENT_OF'
          AND backward_rel_code = 'CHILD_OF'
          AND relationship_type = 'TAX';
Line: 2797

        SELECT count(*) INTO l_count
          FROM hz_relationships
         WHERE relationship_type = l_geography_use
           -- AND subject_type =  l_zone_type
           AND subject_id = p_geography_id
           AND object_id = p_zone_relation_tbl(i).included_geography_id
           AND sysdate between start_date and nvl(end_date, sysdate + 1)
           AND status = 'A'
           AND rownum < 2;
Line: 2818

         SELECT count(*) INTO l_count
           FROM hz_relationships
          WHERE relationship_type=l_geography_use
            AND subject_type=l_zone_type
            AND subject_id = p_geography_id
            AND object_id = p_zone_relation_tbl(i).included_geography_id
           AND sysdate between start_date and nvl(end_date, sysdate + 1)
           AND status = 'A'
            AND rownum <2;
Line: 2944

    p_create_update_flag         =>'C',
    p_column                     => 'zone_type',
    p_column_value               => p_zone_type,
    p_restricted                 => 'N',
    x_return_status              => x_return_status
    );
Line: 2956

    p_create_update_flag         =>'C',
    p_column                     => 'zone_name',
    p_column_value               => p_zone_name,
    p_restricted                 => 'N',
    x_return_status              => x_return_status
    );
Line: 2970

    SELECT geography_use,limited_by_geography_id INTO l_geography_use,l_limited_by_geography_id
      FROM hz_geography_types_b
     WHERE geography_type = p_zone_type;
Line: 2984

    SELECT count(*) INTO l_count
      FROM hz_geographies
     WHERE geography_name = p_zone_name
       AND geography_type = p_zone_type
       AND rownum <2;
Line: 3000

           SELECT count(*) INTO l_count
      FROM hz_geographies
     WHERE geography_code = upper(p_zone_code)
       AND geography_type = p_zone_type
       AND rownum <2;
Line: 3025

       SELECT count(*) INTO l_count
         FROM fnd_timezones_b
        WHERE timezone_code = p_timezone_code
         AND rownum <2;
Line: 3054

     SELECT country_code INTO l_country_code
       FROM hz_geographies
      WHERE geography_id = p_zone_relation_tbl(i).included_geography_id;
Line: 3074

      HZ_GEOGRAPHIES_PKG.insert_row(
    x_rowid                              => l_rowid,
    x_geography_id                       => x_geography_id,
    x_object_version_number              => 1,
    x_geography_type                     => p_zone_type,
    x_geography_name                     => p_zone_name,
    x_geography_use                      => l_geography_use,
    x_geography_code                     => UPPER(p_zone_code),
    x_start_date                         => NVL(p_start_date,SYSDATE),
    x_end_date                           => NVL(p_end_date,l_end_date),
    x_multiple_parent_flag               => 'N',
    x_created_by_module                  => p_created_by_module,
    x_country_code                       => l_country_code,
    x_geography_element1                 => NULL,
    x_geography_element1_id              => NULL,
    x_geography_element1_code            => NULL,
    x_geography_element2                 => NULL,
    x_geography_element2_id              => NULL,
    x_geography_element2_code            => NULL,
    x_geography_element3                 => NULL,
    x_geography_element3_id              => NULL,
    x_geography_element3_code            => NULL,
    x_geography_element4                 => NULL,
    x_geography_element4_id              => NULL,
    x_geography_element4_code            => NULL,
    x_geography_element5                 => NULL,
    x_geography_element5_id              => NULL,
    x_geography_element5_code            => NULL,
    x_geography_element6                 => NULL,
    x_geography_element6_id              => NULL,
    x_geography_element7                 => NULL,
    x_geography_element7_id              => NULL,
    x_geography_element8                 => NULL,
    x_geography_element8_id              => NULL,
    x_geography_element9                 => NULL,
    x_geography_element9_id              => NULL,
    x_geography_element10                => NULL,
    x_geography_element10_id             => NULL,
    x_geometry                           => p_geometry,
    x_timezone_code                      => p_timezone_code,
    x_application_id                     => p_application_id,
    x_program_login_id                   => 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,
    x_attribute16                        => NULL,
    x_attribute17                        => NULL,
    x_attribute18                        => NULL,
    x_attribute19                        => NULL,
    x_attribute20                        => NULL
    );
Line: 3141

     SELECT userenv('LANG') INTO l_language_code FROM dual;
Line: 3327

 * PROCEDURE update_relationship
 *
 * DESCRIPTION
 *     Updates Geography Relationships.
 *
 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
 *
 * ARGUMENTS
 *   IN:
 *     p_init_msg_list                Initialize message stack if it is set to
 *                                    FND_API.G_TRUE. Default is FND_API.G_FALSE.
 *     p_master_relation_rec          Geography type record.
 *     p_object_version_number        Object version number of the row
 *   IN/OUT:
 *   OUT:
 *
 *     x_return_status                Return status after the call. The status can
 *                                    be FND_API.G_RET_STS_SUCCESS (success),
 *                                    FND_API.G_RET_STS_ERROR (error),
 *                                    FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
 *     x_msg_count                    Number of messages in message stack.
 *     x_msg_data                     Message text if x_msg_count is 1.
 *
 * NOTES
 *
 * MODIFICATION HISTORY
 *     11-22-2002    Rekha Nalluri        o Created.
 *
 */

PROCEDURE update_relationship (
    p_init_msg_list             IN         VARCHAR2 := FND_API.G_FALSE,
    p_relationship_id           IN         NUMBER,
    p_status                    IN         VARCHAR2,
    p_object_version_number     IN OUT  NOCOPY   NUMBER,
    x_return_status             OUT     NOCOPY   VARCHAR2,
    x_msg_count                 OUT     NOCOPY   NUMBER,
    x_msg_data                  OUT     NOCOPY   VARCHAR2
)IS

 BEGIN
 -- Standard start of API savepoint
    SAVEPOINT update_relationship;
Line: 3380

    do_update_relationship(
        p_relationship_id              => p_relationship_id,
        p_status                        => p_status,
        p_object_version_number         => p_object_version_number,
        x_return_status                 => x_return_status
       );
Line: 3400

        ROLLBACK TO update_relationship;
Line: 3407

        ROLLBACK TO update_relationship;
Line: 3415

        ROLLBACK TO update_relationship;
Line: 3425

END update_relationship;
Line: 3539

 * PROCEDURE update_geo_identifier
 *
 * DESCRIPTION
 *     Creates Geography Identifiers.
 *
 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
 *
 * ARGUMENTS
 *   IN:
 *     p_init_msg_list                Initialize message stack if it is set to
 *                                    FND_API.G_TRUE. Default is FND_API.G_FALSE.
 *     p_geo_identifier_rec           Geo_identifier type record.
 *
 *   IN/OUT:
 *     p_object_version_number
 *   OUT:
 *
 *     x_cp_request_id                Concurrent Program Request Id, whenever CP
 *                                    to update denormalized data gets kicked off.
 *     x_return_status                Return status after the call. The status can
 *                                    be FND_API.G_RET_STS_SUCCESS (success),
 *                                    FND_API.G_RET_STS_ERROR (error),
 *                                    FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
 *     x_msg_count                    Number of messages in message stack.
 *     x_msg_data                     Message text if x_msg_count is 1.
 *
 * NOTES
 *
 * MODIFICATION HISTORY
 *     12-03-2002    Rekha Nalluri        o Created.
 *     21-Oct-2005   Nishant          Added  x_cp_request_id OUT parameter
 *                                    for Bug 457886
 *
 */
PROCEDURE update_geo_identifier (
    p_init_msg_list             IN         VARCHAR2 := FND_API.G_FALSE,
    p_geo_identifier_rec        IN         GEO_IDENTIFIER_REC_TYPE,
    p_object_version_number     IN OUT NOCOPY    NUMBER,
    x_cp_request_id             OUT    NOCOPY   NUMBER,
    x_return_status             OUT    NOCOPY    VARCHAR2,
    x_msg_count                 OUT    NOCOPY    NUMBER,
    x_msg_data                  OUT    NOCOPY    VARCHAR2
)IS

   BEGIN

   -- Standard start of API savepoint
    SAVEPOINT update_geo_identifier;
Line: 3597

    do_update_geo_identifier(
        p_geo_identifier_rec           =>  p_geo_identifier_rec,
        p_object_version_number         => p_object_version_number,
        x_cp_request_id                => x_cp_request_id,
        x_return_status                 => x_return_status
       );
Line: 3617

        ROLLBACK TO update_geo_identifier;
Line: 3624

        ROLLBACK TO update_geo_identifier;
Line: 3632

        ROLLBACK TO update_geo_identifier;
Line: 3642

END update_geo_identifier;
Line: 3645

 * PROCEDURE delete_geo_identifier
 *
 * DESCRIPTION
 *     Deletes Geography Identifiers.
 *
 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
 *
 * ARGUMENTS
 *   IN:
 *     p_init_msg_list                Initialize message stack if it is set to
 *                                    FND_API.G_TRUE. Default is FND_API.G_FALSE.
 *     p_geography_id                 geography id
 *     p_identifier_type
 *     p_identifier_subtype
 *     p_identifier_value
 *
 *   OUT:
 *
 *     x_return_status                Return status after the call. The status can
 *                                    be FND_API.G_RET_STS_SUCCESS (success),
 *                                    FND_API.G_RET_STS_ERROR (error),
 *                                    FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
 *     x_msg_count                    Number of messages in message stack.
 *     x_msg_data                     Message text if x_msg_count is 1.
 *
 * NOTES
 *
 * MODIFICATION HISTORY
 *     01-02-2003    Rekha Nalluri        o Created.
 *
 */

 PROCEDURE delete_geo_identifier(
      p_init_msg_list           IN VARCHAR2 := FND_API.G_FALSE,
      p_geography_id		IN NUMBER,
      p_identifier_type	        IN VARCHAR2,
      p_identifier_subtype	IN VARCHAR2,
      p_identifier_value        IN VARCHAR2,
      p_language_code           IN VARCHAR2,
      x_return_status           OUT NOCOPY VARCHAR2,
      x_msg_count               OUT NOCOPY NUMBER,
      x_msg_data                OUT NOCOPY VARCHAR2
      ) IS
    BEGIN

   -- Standard start of API savepoint
    SAVEPOINT delete_geo_identifier;
Line: 3702

    do_delete_geo_identifier(
        p_geography_id                  => p_geography_id,
        p_identifier_type               => p_identifier_type,
        p_identifier_subtype            => p_identifier_subtype,
        p_identifier_value              => p_identifier_value,
        p_language_code                 => p_language_code,
        x_return_status                 => x_return_status
       );
Line: 3724

        ROLLBACK TO delete_geo_identifier;
Line: 3731

        ROLLBACK TO delete_geo_identifier;
Line: 3739

        ROLLBACK TO delete_geo_identifier;
Line: 3749

END delete_geo_identifier;
Line: 3854

 * PROCEDURE update_geography
 *
 * DESCRIPTION
 *     Updates Geography
 *
 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
 *
 * ARGUMENTS
 *   IN:
 *     p_init_msg_list                Initialize message stack if it is set to
 *                                    FND_API.G_TRUE. Default is FND_API.G_FALSE.
 *     p_master_geography_rec         Master Geography type record.
 *
 *   IN/OUT:
 *     p_object_version_number
 *   OUT:
 *
 *     x_return_status                Return status after the call. The status can
 *                                    be FND_API.G_RET_STS_SUCCESS (success),
 *                                    FND_API.G_RET_STS_ERROR (error),
 *                                    FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
 *     x_msg_count                    Number of messages in message stack.
 *     x_msg_data                     Message text if x_msg_count is 1.
 *
 * NOTES
 *
 * MODIFICATION HISTORY
 *     12-12-2002    Rekha Nalluri        o Created.
 *
 */
PROCEDURE update_geography (
    p_init_msg_list             IN         VARCHAR2 := FND_API.G_FALSE,
    p_geography_id              IN        NUMBER,
    p_end_date                  IN        DATE,
    p_geometry                  IN        MDSYS.SDO_GEOMETRY,
    p_timezone_code             IN        VARCHAR2,
    p_object_version_number     IN OUT  NOCOPY   NUMBER,
    x_return_status             OUT     NOCOPY   VARCHAR2,
    x_msg_count                 OUT     NOCOPY   NUMBER,
    x_msg_data                  OUT     NOCOPY   VARCHAR2
) IS

  BEGIN

   -- Standard start of API savepoint
    SAVEPOINT update_geography;
Line: 3910

    do_update_geography(
        p_geography_id                  => p_geography_id,
        p_end_date                      => p_end_date,
        p_geometry                      => p_geometry,
        p_timezone_code                 => p_timezone_code,
        p_object_version_number         => p_object_version_number,
        x_return_status                 => x_return_status
       );
Line: 3932

        ROLLBACK TO update_geography;
Line: 3939

        ROLLBACK TO update_geography;
Line: 3947

        ROLLBACK TO update_geography;
Line: 3957

END update_geography;
Line: 4074

 * PROCEDURE update_geography_range
 *
 * DESCRIPTION
 *     Updates Geography range
 *
 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
 *
 * ARGUMENTS
 *   IN:
 *     p_init_msg_list                Initialize message stack if it is set to
 *                                    FND_API.G_TRUE. Default is FND_API.G_FALSE.
 *     geography_id
 *     geography_from
 *     start_date
 *     end_date
 *
 *   IN/OUT:
 *     p_object_version_number
 *   OUT:
 *
 *     x_return_status                Return status after the call. The status can
 *                                    be FND_API.G_RET_STS_SUCCESS (success),
 *                                    FND_API.G_RET_STS_ERROR (error),
 *                                    FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
 *     x_msg_count                    Number of messages in message stack.
 *     x_msg_data                     Message text if x_msg_count is 1.
 *
 * NOTES
 *
 * MODIFICATION HISTORY
 *     01-23-2003    Rekha Nalluri        o Created.
 *
 */
PROCEDURE update_geography_range (
    p_init_msg_list             IN         VARCHAR2 := FND_API.G_FALSE,
    p_geography_id              IN        NUMBER,
    p_geography_from            IN        VARCHAR2,
    p_start_date                IN        DATE,
    p_end_date                  IN        DATE,
    p_object_version_number     IN OUT  NOCOPY   NUMBER,
    x_return_status             OUT     NOCOPY   VARCHAR2,
    x_msg_count                 OUT     NOCOPY   NUMBER,
    x_msg_data                  OUT     NOCOPY   VARCHAR2
) IS

BEGIN

   -- Standard start of API savepoint
    SAVEPOINT update_geography_range;
Line: 4133

    do_update_geography_range(
        p_geography_id                  => p_geography_id,
        p_geography_from                => p_geography_from,
        p_start_date                    => p_start_date,
        p_end_date                      => p_end_date,
        p_object_version_number         => p_object_version_number,
        x_return_status                 => x_return_status
       );
Line: 4155

        ROLLBACK TO update_geography_range;
Line: 4162

        ROLLBACK TO update_geography_range;
Line: 4170

        ROLLBACK TO update_geography_range;
Line: 4180

END update_geography_range;