|
From: Joe Pluta <joepluta@xxxxxxxxxxxxxxxxx>view?
To: midrange-l@xxxxxxxxxxxxxxxxxx,
Date: 05/16/2019 05:02 PM
Subject: [EXTERNAL] Re: why data translate error when selecting from
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>
Thatnks for that explanation, Tim. In a related question: do CTEs allow
me to effectively "hardcode" the order, causing the SQL engine to workorder, it
in my predefined sequence?
For example, if in this case I did this:
with t1 as (select * from contr where length(trim(cpcsid)) = 10),
t2 as (select a.cpcono cono, case ... end csno from t1)
select * from t2 where csno = 1346100
Would that force the SQL engine to create my T1 in its entirety (thus
skipping short fields) before then doing the select? Or is the engine
just so darned smart that it ignores my sequence and just optimizes me
into errors? Of course, upon further reflection, if
length(trim(cpcsid)) = 10, then no need to check for blanks, so no CASE
statement. But I digress...
On 5/16/2019 4:36 PM, Timothy P Clark wrote:
You can think of the query engine "inlining" the view into the final
select statement.
<...snip lots of relevant and cool stuff...>
Keeping in mind that SQL has no rules about predicate evaluation
listshould be clear that if the optimizer chooses to evaluate the 2nd
predicate before the first predicate, we can run into the error you're
seeing.
--
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=DwIGaQ&c=jf_iaSHvJObTbx-
To subscribe, unsubscribe, or change list options,
visit: https://urldefense.proofpoint.com/v2/url?
siA1ZOg&r=oCmVbiwufH6yM8U29GriOcB5LKDoEG8y1HZD-01RVtc&m=uIFIUpL4kLjo726zd1hGUB8znDqd5lwGjlGB_n14Gds&s=upUivQxU54IEPST7W6WD7ClY4OABHgBLq47FZQ9fPvQ&e=
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxxsiA1ZOg&r=oCmVbiwufH6yM8U29GriOcB5LKDoEG8y1HZD-01RVtc&m=uIFIUpL4kLjo726zd1hGUB8znDqd5lwGjlGB_n14Gds&s=9hUfo5-
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=DwIGaQ&c=jf_iaSHvJObTbx-
Jsc8rw-Nc0PpdYV26783BHKMUqEKwpQr4JME&e=.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=uIFIUpL4kLjo726zd1hGUB8znDqd5lwGjlGB_n14Gds&s=ryY7pNASzUnVB0hx1rBpE2qPcN3fHc375U4UJD2dmrk&e=
u=https-3A__amazon.midrange.com&d=DwIGaQ&c=jf_iaSHvJObTbx-
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.