|
From: Steve Richter <stephenrichter@xxxxxxxxx><midrange-l@xxxxxxxxxxxxxxxxxx>,
To: Midrange Systems Technical Discussion
Date: 05/16/2019 02:14 PMwrote:
Subject: [EXTERNAL] Re: Re: Re: why data translate error when
selecting from view?
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>
On Thu, May 16, 2019 at 1:10 PM Timothy P Clark <timclark@xxxxxxxxxx>
data
With the index, the optimizer chooses to evaluate the problematic
[CASE...END] = 1346100 predicate before it evaluates the
LENGTH(TRIM(CPCSID))=10 predicate. It does this because it splits the
pushes asaccess into an index scan and a table probe. For performance, it
aremuch selection into the index scan as it can. But because char fields
tostored in the index without trailing blanks, the optimizer has to wait
indexevaluate the LENGTH of a char field until has the "real" data from the
table.
On the other hand, the TRANSLATE predicate can be evaluated in the
[CASE...END] =scan node. There's no need to defer its evaluation until later. This
allows it to be evaluated (to FALSE) before the problematic
(and1346100 predicate. This gives you the behavior that you are seeing
correctlyexpecting.)
but the CSNO column from the view is run thru the CASE statement. Which
only translates to decimal if the length is 10:
select a.cpcono cono,
case when length(trim(a.cpcsid)) = 10
then decimal(a.cpcsid,10,0)
else decimal(0,10,0) end csno,
I can post the VIEW code again on Monday. How to code the VIEW
using LENGTH and TRIM?list
thanks,
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxxu=https-3A__lists.midrange.com_mailman_listinfo_midrange-2Dl&d=DwICAg&c=jf_iaSHvJObTbx-
To subscribe, unsubscribe, or change list options,
visit: https://urldefense.proofpoint.com/v2/url?
siA1ZOg&r=oCmVbiwufH6yM8U29GriOcB5LKDoEG8y1HZD-01RVtc&m=0Rqj0wZiIVMHvwpNuJVttG3Q2pdzzOwJOW_wvKXpsYc&s=HjrLZovL9AoI_1nFi_zKIvs5ci7_phqmKXcVTDw1a5I&e=
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxxsiA1ZOg&r=oCmVbiwufH6yM8U29GriOcB5LKDoEG8y1HZD-01RVtc&m=0Rqj0wZiIVMHvwpNuJVttG3Q2pdzzOwJOW_wvKXpsYc&s=91EZpjTs3LMW7_DmHz8uOJwGBY62Wqy0ycKkFpxEo0c&e=
Before posting, please take a moment to review the archives
at https://urldefense.proofpoint.com/v2/url?
u=https-3A__archive.midrange.com_midrange-2Dl&d=DwICAg&c=jf_iaSHvJObTbx-
.questions.
Please contact support@xxxxxxxxxxxx for any subscription related
link:
Help support midrange.com by shopping at amazon.com with our affiliate
https://urldefense.proofpoint.com/v2/url?siA1ZOg&r=oCmVbiwufH6yM8U29GriOcB5LKDoEG8y1HZD-01RVtc&m=0Rqj0wZiIVMHvwpNuJVttG3Q2pdzzOwJOW_wvKXpsYc&s=YXXZOlo1eq77ZSytvFdhajK1_i_oqVm-
u=https-3A__amazon.midrange.com&d=DwICAg&c=jf_iaSHvJObTbx-
Olkv7uDhiQQ&e=
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.