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
The reason for this is due to presence of below where condition in the view:
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:
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:
//no rows returned
SELECT * FROM AP_INVOICES;
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
)
.....
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
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;
SELECT NVL(USERENV('CLIENT_INFO'),-99) FROM dual;
Comments
Post a Comment