Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Ternary '?' in (PL/)SQL
david_barts_at_my-deja.com a écrit :
> Is there a way to simulate the '?' operator of C-like
> languages, e.g:
>
> select (char_column == 'Y' ? 'Yes' : 'No') from some_table
> where ... ;
Of course, using 'decode()', it gives : select decode(char_column, 'Y', 'YES', 'NO') from some_table ...
But, you can do more, like this :
select decode(char_column,
'Y', 'YES', 'N', 'NO', 'DOUBT') from some_table ...
Like a switch/case in C ...
Bye
Pierre Received on Tue Feb 01 2000 - 11:09:49 CST
![]() |
![]() |