Tuesday, 13 January 2015

Query to find Customer contacts and their roles :

SELECT   oc.JOB_TITLE,
           oc.PARTY_SITE_ID,
           RELATIONSHIP_ID,
           RELATIONSHIP_TYPE,
           hp.PARTY_NAME OBJECT_NAME,                               -- Contact
           OBJECT_ID,
           OBJECT_TYPE,
           OBJECT_TABLE_NAME,
           hr.PARTY_ID,
           RELATIONSHIP_CODE,
           SUBJECT_ID,
           SUBJECT_TYPE,
           SUBJECT_TABLE_NAME,
           oc.TITLE,
           oc.MAIL_STOP,
           oc.CONTACT_KEY,
           ocr.ROLE_TYPE,
           DIRECTIONAL_FLAG
    FROM   HZ_ORG_CONTACT_ROLES ocr,
           HZ_ORG_CONTACTS oc,
           HZ_PARTIES hp,
           HZ_RELATIONSHIPS hr
   WHERE       hr.subject_id = 1004                 --Party id of the customer
           AND hr.object_id = hp.party_id
           AND hr.RELATIONSHIP_ID = oc.PARTY_RELATIONSHIP_ID
           AND oc.ORG_CONTACT_ID = ocr.ORG_CONTACT_ID(+)
ORDER BY   OBJECT_NAME
/




Query to find communication channels for a customer :

SELECT   CONTACT_POINT_ID,
         CONTACT_POINT_TYPE,
         EMAIL_ADDRESS,
         PHONE_NUMBER,
         URL,
         CONTACTS,
         STATUS,
         OWNER_TABLE_NAME,
         OWNER_TABLE_ID,
         PRIMARY_FLAG,
         ORIG_SYSTEM_REFERENCE
  FROM   HZ_CONTACT_POINTS
 WHERE   OWNER_TABLE_NAME = 'HZ_PARTIES' AND OWNER_TABLE_ID = 1004


Query to find Organization type Party info :


SELECT   hp.PARTY_ID,
           hp.PARTY_NUMBER,
           hp.PARTY_NAME,
           hca.ACCOUNT_NUMBER,
           hca.CUST_ACCOUNT_ID,
           hop.ORGANIZATION_PROFILE_ID,
           hop.EFFECTIVE_START_DATE,
           hop.EFFECTIVE_END_DATE,
           hop.ORGANIZATION_NAME,
           hop.DUNS_NUMBER,
           hop.ENQUIRY_DUNS,
           hop.CEO_NAME,
           hop.CEO_TITLE,
           hop.PRINCIPAL_NAME,
           hop.PRINCIPAL_TITLE,
           hop.LEGAL_STATUS,
           hop.CONTROL_YR,
           hop.EMPLOYEES_TOTAL,
           hop.HQ_BRANCH_IND,
           hop.BRANCH_FLAG,
           hop.OOB_IND,
           hop.LINE_OF_BUSINESS
    FROM   HZ_ORGANIZATION_PROFILES hop, HZ_CUST_ACCOUNTS hca, HZ_PARTIES hp
   WHERE       hp.party_name = 'Hilman and Associates'
           AND hp.PARTY_ID = hca.PARTY_ID
           AND hp.PARTY_ID = hop.PARTY_ID
           AND SYSDATE BETWEEN hop.EFFECTIVE_START_DATE
                           AND  NVL (hop.EFFECTIVE_END_DATE, SYSDATE + 1)
ORDER BY   hca.ACCOUNT_NUMBER

3 comments:

  1. -------------------CUSTOMER ACCOUNT CONTACT INFO
    select hp.party_name
    ,hp1.party_name Contact_name
    ,hoc.contact_number
    ,hcar.cust_acct_site_id
    ,hca.cust_account_id
    from apps.hz_parties hp
    ,apps.hz_cust_accounts hca
    ,apps.hz_org_contacts hoc
    ,apps.hz_cust_account_roles hcar
    ,apps.hz_parties hp1
    ,apps.hz_relationships hr
    where 1 = 1
    and hca.party_id = hp.party_id
    AND hr.subject_id = hp1.party_id
    AND hr.object_id = hp.party_id
    AND hcar.party_id = hr.party_id
    AND hoc.party_relationship_id = hr.relationship_id
    AND hcar.cust_acct_site_id is null
    AND hcar.STATUS like 'A';

    -------------------CUSTOMER ACCOUNT SITE CONTACT INFO
    select hp.party_name
    ,hp1.party_name Contact_name
    ,hoc.contact_number
    ,hps.party_site_id
    ,hps.PARTY_SITE_NUMBER
    from apps.hz_parties hp
    ,apps.hz_party_sites hps
    ,apps.hz_cust_accounts hca
    ,apps.hz_cust_acct_sites_all hcas
    ,apps.hz_org_contacts hoc
    ,apps.hz_cust_account_roles hcar
    ,apps.hz_parties hp1
    ,apps.hz_relationships hr
    where 1 = 1
    and hp.party_id = hps.party_id
    and hca.party_id = hp.party_id
    and hca.cust_account_id = hcas.cust_account_id
    and hcas.party_site_id = hps.party_site_id
    and hcar.cust_acct_site_id(+) = hcas.cust_acct_site_id
    AND hr.subject_id = hp1.party_id
    AND hr.object_id = hp.party_id
    AND hcar.party_id = hr.party_id
    AND hoc.party_relationship_id = hr.relationship_id
    AND hcar.STATUS like 'A'

    ReplyDelete
  2. I want to share a testimony on how Le_Meridian funding service helped me with loan of 2,000,000.00 USD to finance my marijuana farm project , I'm very grateful and i promised to share this legit funding company to anyone looking for way to expand his or her business project.the company is funding company. Anyone seeking for finance support should contact them on lfdsloans@outlook.com Or lfdsloans@lemeridianfds.com Mr Benjamin is also on whatsapp 1-989-394-3740 to make things easy for any applicant. 

    ReplyDelete
  3. Thanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle ADF .
    Actually, I was looking for the same information on internet for
    Oracle ADF Interview Questions and Answers/Tips and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject.



    ReplyDelete