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!

How to construct SQL "in" statement from multiple values in a text area

PaulPNov 8 2018 — edited Nov 8 2018

APEX 18.1

I have a text area (right) that is populated using a DA set value action from an autocomplete item (left) (NOTE: there are 4.5 million record ids to choose from!)

pastedImage_1.png

I want to return records for the chosen case id's in an IG. I have a computation that generates the following list from the values in the text area using the SQL Expression

replace(replace(replace (:P1000_SEARCH_CASE_MULTIPLE,chr(10),','),chr(13),''),' ','')

and put it into the field P1004_CAS_UID_MULTIPLE

pastedImage_2.png

I want to pass this list into an "IN" statement in the IG where clause.

e.g.

.... I have tried the following but they don't work

where cas_uid in (:P1004_CAS_UID_MULTIPLE)

where cas_uid in (&P1004_CAS_UID_MULTIPLE.)

I couldn't get this code to work either

https://blogs.oracle.com/aramamoo/how-to-split-comma-separated-string-and-pass-to-in-clause-of-select-statement

This works but is REALLLLY slow especially if you use any LOVs in the IG

...

where instr(:P1004_CAS_UID_MULTIPLE,CAS_UID) >0

If I hard code where cas_uid in (2642884,2642886,2642888) , the performance is fast.

Any suggestions appreciated

PaulP

This post has been answered by fac586 on Nov 8 2018
Jump to Answer
Comments
Post Details
Added on Nov 8 2018
6 comments
662 views