Geography Tree
select FTV.tree_name tree_name_gmgt,
FTVV.tree_version_name tree_version_name_gmgt,
(SELECT set_name
from FND_SETID_SETS_VL
where set_id = FTV.set_id) set_name_gmgt,
FTVV.status status_gmgt,
FTVV.tree_structure_code tree_structure_code_gmgt,
FTVV.efFective_start_date efFective_start_date_gmgt,
FTVV.effective_end_date effective_end_date_gmgt,
FTD.data_source_name data_source_name_gmgt,
PGTN.pk1_start_value pk1_start_value_gmgt
from per_geo_tree_node PGTN,
FND_TREE_VERSION_VL FTVV,
FND_TREE_VL FTV,
FND_TS_DATA_SOURCE_VL FTD
where PGTN.tree_version_id = FTVV.tree_version_id
and PGTN.tree_code = FTV.tree_code
and PGTN.data_source_id = FTD.data_source_id
AND (
(:P_CREATION_TYPE= 'Custom' and PGTN.created_by <> 'SEED_DATA_FROM_APPLICATION' )
OR (:P_CREATION_TYPE = 'Seeded' and PGTN.created_by = 'SEED_DATA_FROM_APPLICATION' )
OR (:P_CREATION_TYPE = 'Seeded Modified' and PGTN.created_by = 'SEED_DATA_FROM_APPLICATION' and PGTN. last_updated_by <> 'SEED_DATA_FROM_APPLICATION')
OR (:P_CREATION_TYPE = 'ALL')
)
/*AND ((:P_CREATION_TYPE= 'Custom' and FTV.CREATED_BY <> 'SEED_DATA_FROM_APPLICATION' ) OR (:P_CREATION_TYPE = 'Seeded' and FTV.CREATED_BY = 'SEED_DATA_FROM_APPLICATION' ))
AND ((:P_CREATION_TYPE= 'Custom' and FTD.CREATED_BY <> 'SEED_DATA_FROM_APPLICATION' ) OR (:P_CREATION_TYPE = 'Seeded' and FTD.CREATED_BY = 'SEED_DATA_FROM_APPLICATION' ))
AND ((:P_CREATION_TYPE= 'Custom' and FTVV.CREATED_BY <> 'SEED_DATA_FROM_APPLICATION' ) OR (:P_CREATION_TYPE = 'Seeded' and FTVV.CREATED_BY = 'SEED_DATA_FROM_APPLICATION' ))*/