Tuesday, June 7, 2016

Oracle TCA Party Relationships view - HZ_RELATIONSHIPS_V

SELECT rel.ROWID row_id, rel.relationship_id relationship_id,
       rel.subject_id subject_id, rel.subject_type subject_type,
       rel.subject_table_name subject_table_name, rel.object_id object_id,
       rel.object_type object_type, rel.object_table_name object_table_name,
       rel.party_id party_id, lookup.meaning relationship_meaning,

       rel.relationship_code relationship_code,
       rel.directional_flag directional_flag, rel.comments comments,
       rel.start_date start_date, rel.end_date end_date, rel.status status,
       rel.created_by created_by, rel.creation_date creation_date,
       rel.last_updated_by last_updated_by,
       rel.last_update_date last_update_date,
       rel.last_update_login last_update_login,
       rel.wh_update_date wh_update_date, rel.request_id request_id,
       rel.program_application_id program_application_id,
       rel.program_id program_id, rel.program_update_date program_update_date,
       rel.attribute_category attribute_category, rel.attribute1 attribute1,
       rel.attribute2 attribute2, rel.attribute3 attribute3,
       rel.attribute4 attribute4, rel.attribute5 attribute5,
       rel.attribute6 attribute6, rel.attribute7 attribute7,
       rel.attribute8 attribute8, rel.attribute9 attribute9,
       rel.attribute10 attribute10, rel.attribute11 attribute11,
       rel.attribute12 attribute12, rel.attribute13 attribute13,
       rel.attribute14 attribute14, rel.attribute15 attribute15,
       rel.attribute16 attribute16, rel.attribute17 attribute17,
       rel.attribute18 attribute18, rel.attribute19 attribute19,
       rel.attribute20 attribute20,
       rel.content_source_type content_source_type,
       rel.relationship_type relationship_type,
       rel.object_version_number object_version_number,
       rel.created_by_module created_by_module,
       rel.application_id application_id, party.party_name party_name,
       party.party_number party_number, party.party_type party_type,
       lot.meaning
  FROM hz_relationships rel,
       hz_parties party,
       ar_lookups lookup,
       ar_lookups lot
 WHERE subject_table_name = 'HZ_PARTIES'
   AND object_table_name = 'HZ_PARTIES'
   AND rel.object_id = party.party_id
   AND lookup.lookup_type = 'PARTY_RELATIONS_TYPE'
   AND lookup.lookup_code = rel.relationship_code
   AND lot.lookup_type = 'PARTY_RELATIONS_TYPE'
   AND lot.lookup_code = rel.relationship_type
   AND EXISTS (
          SELECT 'Y'
            FROM hz_code_assignments code, hz_relationship_types reltype
           WHERE reltype.relationship_type = rel.relationship_type
             AND code.owner_table_id = reltype.relationship_type_id
             AND code.class_category = 'RELATIONSHIP_TYPE_GROUP'
             AND code.class_code = 'PARTY_REL_GRP_CUST_INFO'
             AND code.owner_table_name = 'HZ_RELATIONSHIP_TYPES')