Contact Party ID for a Customer - Used When Importing an Order.sql
Published February 22, 2026
By Sai Sree Ram Gundepudi
SELECT DECODE (Contact.PARTY_ID , NVL(Org.PREFERRED_CONTACT_PERSON_ID, -2), 'Y' , 'N') AS PRIMARY_CONTACT_FLAG , Contact.party_name , Contact.PERSON_FIRST_NAME , Relationship.RELATIONSHIP_ID AS CONTACT_ID FROM HZ_PARTIES Contact , HZ_PARTIES Org , HZ_RELATIONSHIPS Relationship WHERE Relationship.OBJECT_ID = Org.PARTY_ID AND Contact.PARTY_ID = Relationship.SUBJECT_ID AND Org.PARTY_ID =