|
Well, you can do things like
...
case when length(trim(a.cpcsid)||trim(a.cpcsid)) = 20
then decimal(a.cpcsid,10,0)
else decimal(0,10,0) end csno,
...
where length(trim(a.cpcsid)) = 10
The optimizer isn't (yet) smart enough to recognize that
length(trim(a.cpcsid)||trim(a.cpcsid)) = 20 is equivalent to
length(trim(a.cpcsid)) = 10, so it won't consider the when clause to be
covered by the selection predicate.
But at the point that you start having to try to trick the optimizer into
not optimizing the query (and the purpose of all of the transformations
that I've described is to optimize performance), it's maybe time to think
about improving the data model you're working with.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.