Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle Apex Cursor sql for Apex collections needs to be modified

VinipandaJun 2 2023

I have an Apex Page with Interactive grid and a validation put on the grid on submit button.

The validation is using the collection : COLLECTION_1 already created.

I want to include a scenario in the cursor query for collections and need help with the same.

Currently the query is:

c001 - EMP_ID
c002- DEPT_ID
c003 - Employee_Name
c004 - BU
Cursor cur is
SELECT c001,c002,c003,C004
LISTAGG(c003, '-') WITHIN GROUP (ORDER BY c003)
OVER (PARTITION BY c002) c004_emp_group
FROM apex_collections where collection_name='COLLECTION_1' and c004 ='BU-001'  and c001 = :EMP_ID and c002= :DEPT_ID;

Currently this collection should include only those employees with BU = 'BU-001'

But there is an exception. It should now also work if EMP_ID starts with 9 and DEPT_ID =4. c001 like '9%' and c002=4 So even if the BU for this scenario is other than BU-001, it should still include this particular combo..

I m confused as to what would be the best way to include this scenario, whether using case or how can it be done.

Comments
Post Details
Added on Jun 2 2023
0 comments
259 views