SQL Language (MOSC)

MOSC Banner

can we have a SQL query inside CASE/DECODE?

edited Mar 6, 2019 12:18PM in SQL Language (MOSC) 3 commentsAnswered ✓

Hi

I am trying something like this:

select sid,case con_id when 1 then 'ROOT'

when 2 then 'SEED'

when 3 then 'select name from v$pdbs'

else to_char(con_id) end

from v$session where sid=2294;

When value is 3, it just shows the entire SQL but does not run as to show the output of it. I assume it is not permitted to have SQL inside CASE or DECODE, but I am trying to find if there is a way to do so.

Thanks

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center