How to set CLIENT_INFO in oracle apps?

In oracle apps there are some views which use CLIENT_INFO. For example, AP_INVOICES. So, when you query data using the below statement you will get no rows


//no rows returned
SELECT * FROM AP_INVOICES;


The reason for this is due to presence of below where condition in the view:



//where condition of ap_invoices
.....
FROM AP_INVOICES_ALL
WHERE
    NVL(    ORG_ID,
            NVL(
                TO_NUMBER(
                    DECODE( SUBSTRB( USERENV('CLIENT_INFO'), 1, 1),
                           ' ', NULL,
                           SUBSTRB(USERENV('CLIENT_INFO'), 1, 10)
                    )
                ), - 99
            )
    ) = NVL(
            TO_NUMBER(
                DECODE( SUBSTRB(USERENV('CLIENT_INFO'), 1, 1),
                        ' ', NULL,
                        SUBSTRB(USERENV('CLIENT_INFO'), 1, 10)
                )
            ), - 99
        )

So, In order to get data from ap_invoices view we need to first set the CLIENT_INFO. You can set the CLIENT_INFO using the below procedure:


DBMS_APPLICATION_INFO.SET_CLIENT_INFO (
   client_info IN VARCHAR2); 
 
So, you can run the above procedure using the below code:


//setting client info as 120
BEGIN
   DBMS_APPLICATION_INFO.SET_CLIENT_INFO ('120');
END; 

Here, we have set CLIENT_INFO as 120, which is the one of the org id's available in HR_ALL_ORGANIZATION_UNITS. So from now onwards we can view the invoices of ORG ID: 120

You can also check the current CLIENT_INFO using the below query:

//Check current CLIENT_INFO value
SELECT NVL(USERENV('CLIENT_INFO'),-99) FROM dual;

Comments

All Categories

Call Fusion BIP Report2 Change Password1 Code Combinations2 Compute Instance2 CTE1 Customer1 Data Aggregation2 Database5 Date Conversion1 DB Adapter2 Decryption1 Development1 EBS4 Encryption1 ESS Jobs3 Examine1 FBDI3 Fusion APIs1 Fusion BIP7 GIT2 GL3 GL Journals1 GL_DAILY_CONVERSION_TYPES1 GL_DAILY_RATES1 ICS1 Identity Domain1 Integrations1 Java1 Journal Import1 Keys1 Legal Entity1 LookupTypeLOV1 LOV1 LOVs1 MultiPartAPIs1 Networking1 NVL2 NVL in OIC2 OCI11 OCI Billing1 OCI Compute5 OCI Cost Management1 OCI Events Service1 OCI Free Tier3 OCI Notifification Service1 OCI Security3 OIC4 OIC Mapper2 Oracle26 Oracle ADF17 Oracle APEX1 Oracle Apps59 Oracle Apps R126 Oracle ATP1 Oracle BIP8 Oracle Cloud12 Oracle Cloud Free Tier1 Oracle cloud Infrastructure9 Oracle Cloud Security2 Oracle Cloud VM1 Oracle DB4 oracle ebs5 Oracle ERP4 Oracle ERP Adapter2 Oracle ERP Cloud7 Oracle financials2 Oracle Forms1 Oracle Fusion57 Oracle Fusion BIP4 Oracle Fusion ERP17 Oracle Fusion Financials18 Oracle Integration Cloud3 Oracle OAF17 Oracle OCI14 Oracle OIC22 Oracle SOA 12c10 Oracle SQL17 Oracle VBCS1 Oracle VBS2 Oracle Visual Builder Cloud Service1 Oracle Visual Builder Studio2 Oracle Workflow Notifications1 Others10 Payables2 Payables Import1 Properties1 R121 Register BIP as ESS Job1 Reset Password1 Responsibility1 REST4 Security List1 Site Map1 SOAP2 SOAP API2 SOAP UI3 SQL16 SQL Functions3 SQL Queries14 SQL Query8 SQL Tips3 SSH1 TCA1 Value Sets1 VBCS1 Virtual Machine2 Virtual Machines1 XML1 XSLT1
Show more