Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Please Help on Decode statement
On 12 Nov 1997 17:35:22 GMT, jomarlen_at_aol.com (Jomarlen) wrote:
>>Hi Mujahid,
>>
>>using decode with the dual table will do what you want:
>>select decode(v_name,'one'1,'two,2) from dual
>>
>>HTH,
>>Peter
>>
>>
>
>Yes sure, but now you are making a totally
>unnecessary trip to the database.
>
>What's wrong with using IF anyway?
>
>It's part of what a prcedural language is all
>about
>
>John
>-------------------------------------------------------
>John C. Lennon
Hi John,
I had in mind that it was serverside PL/SQL, so that you "only" have an unnecessary table access. I'm not quite sure if it's really so bad if you have an easy-to-type,easy-to-read,easy-to-maintain decode expression compared with a monstrous IF-ELSIF construct.
Someone should definitely tell Oracle that in a procedural language, some kind of CASE..ELSE or SWITCH..DEFAULT construct is a must.
I agree with you that it's not so nice when you code this one in a form as central part of n nested loops (n>something) because of additional SQL Net round trips.
BTW, I had a typo and forgot the into clause in my first follow-up. I think one should not post if it's already after midnight :-)
Regards,
Peter
Peter Schneider
pschneider.ctj_at_metronet.de
Received on Wed Nov 12 1997 - 00:00:00 CST
![]() |
![]() |