Reputation: 7752
Is it possible to define an inline array to use with the IN
operator in Oracle SQL 12c? Pseudo code:
SELECT *
FROM T_AUDIO_PLAYERS
WHERE NAME IN {'foo', 'bar'};
Background: I have a Java tool, that's reading in valid .SQL files and replaces SQL-Variables like :NAME
before execution.
Upvotes: 0
Views: 497
Reputation: 2800
You can use LISTAGG
function like
SELECT *
FROM T_AUDIO_PLAYERS
WHERE NAME IN (select LISTAGG() ...);
More detail here
Upvotes: 0
Reputation: 308
I am not sure if I understand your question correctly. However, if you change your {-brackets to (-brackets, this should already work:
SELECT *
FROM T_AUDIO_PLAYERS
WHERE NAME IN ('foo', 'bar');
Upvotes: 2