Skip to content
Advertisement

How to tokenize semicolon separated column value to pass to IF statement in a function in Oracle DB

I have a table called ‘config’ and when I query it in following manner:

SELECT value FROM config WHERE property = 'SPECIAL_STORE_ID'

its response will be: 59216;131205;76707;167206 //... (1)

I want to tokenize the above values using semicolon as the delimiter and then use them in a user-defined Function’s IF statement to compare, something like this:

where in_store_id is the parameter passed-in to the function

Is this possible to do as one-liner in (2) above ?

I’m on Oracle 12c

Advertisement

Answer

One-liner? I don’t think so, but – if you’re satisfied with something like this, fine.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement