Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sybase vs Oracle - which is better?
Tom,
Cute? This type of syntax originated in Oracle SQL programming
back in the "old days" of say Oracle 4.0 when DECODE did not exist.
One of the reasons they built DECODE was to solve "characteristic
function programming issues". Mainly, this stuff is fast and going
through core engine functions like CASE or DECODE might actually
be slower than math functions. And it is more portable, at times,
than using CASE (is there CASE in Oracle, or just DECODE?). If standard
math functions were used - it should port even better between
database engines.
This isn't Cute - it's a solution. Solutions solve business problems. Management of companies who request that IT departments (the groups reading/writing to these newsgroups) solve their business problems with any type of code that makes sense. As long as it's maintainable, doesn't cause another Y2K "rediculous industry problem caused by saving 2 bytes" and ends up being fast and correct is a good thing.
Anway - a good book on characteristic functions is found in the books section of http://www.sqlforum.com. It describes all the various equality, non-equality, range test and so-on. It also goes on to say that the CASE statement can solve it all as well.
What's a booboo? I'm trying to think if my 3 year old even says that any more :-)
John McVicker
Sybase Professional Services
Philadelphia, PA
Tom Scheeler wrote:
>
> j2brown_at_my-dejanews.com wrote in message <75hq09$5fi$1_at_nnrp1.dejanews.com>...
> >You don't even need a CASE statement. If you're clever, you
> >can **simulate** a case statement with Abs(), Patindex(), ASCII(),
> >etc. even back in version 4.9x.
> >
> >
> >e.g. Select 0.5*Patindex(A.condition_expression,'Y') +
> > 1.0*Patindex(A.condition_expression,'N')
> >
> >Regards,
> >J
> >
>
> Getting "cute" is not good programming practice. It will likely bite you on
> the booboo somewhere down the road.
>
> Tom
Received on Mon Dec 28 1998 - 00:00:00 CST