I got this in a query which works normally:
decode(substr(X_AV_ID,1,3)
,'ECU','eCom'
, decode(aven.lib, 'eCom', 'eCom','Autre')) flag,
Then I want to add a new parameter (aven.lib Like '%Extra%' and to decode it as 'extra').
So I create a subquery with a case to do it:
decode(substr(X_AV_ID,1,3),
'ECU', 'eCom',
(select Case
When aven.lib = 'eCom' Then 'eCom'
When aven.lib Like '%Extra%' Then 'extra'
Else 'Autre'
End
From table_x aven
Limit 1
)
) flag
I limit the result to 1 to evit the ORA-01427 error, but now I got the ORA-00907 error.
I wanted to use the like in the decode command but it is not available.
Thanks for helping.
Using the regexp_like in the case works great, and I get the result excepted.
Case
When substr(X_AV_ID,1,3) = 'ECU' Then 'eCom'
When aven.lib= 'eCom' Then 'eCom'
When REGEXP_LIKE (aven.X_AV_LIBELLE, 'extra', 'i') Then 'extra'
Else 'Autre'
End
Thank you for your help