|
From: Steve Richter <stephenrichter@xxxxxxxxx><midrange-l@xxxxxxxxxxxxxxxxxx>,
To: Midrange Systems Technical Discussion
Date: 05/14/2019 10:09 AMam
Subject: [EXTERNAL] why data translate error when selecting from view?
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>
why would selecting from a view result in a data translate error when I
able to select all the rows and columns of that view and copy to another)
table? ( the view has a WHERE clause which selects rows with valid data
actually
table CONTR has a customer number that stored in a character field. And
some of the values in that char field are not all digits. So I create a
view that selects only the rows where that customer number field
contains a customer number. And in the view, I convert the charactercust
number field to a decimal field.the
I prove this works by creating a new table by selecting all rows from
view:list
create table aplusb1fcc/contrpx as (
select a.* from contrv1 a
) with data
Table CONTRPX in APLUSB1FCC created but was not journaled.
but when I select from the view I get an error:
select a.itcd, a.itno, a.startDate, a.expireDate
from contrv1 a
where a.csno = 1346100
and a.expiredate >= current date
Selection error involving field *N.
Select or omit error on field Cast(Translate(CONTR_1.CPCSID, *UNNAMED
Table) AS member CONTRV1.
here is the view:
create OR REPLACE view aplusb1fcc/contrv1 as
select a.cpcono cono,
case when length(trim(a.cpcsid)) = 10
then decimal(a.cpcsid,10,0)
else decimal(0,10,0) end csno,
a.cpitcd itcd, a.cpitno itno,
a.cpprcd prcd, a.cpngpr ngpr,
DATE(digits(a.cpstcc) || substr(digits(a.cpstdt),1,2) ||
'-' || substr(digits(a.cpstdt),3,2) ||
'-' || substr(digits(a.cpstdt),5,2)) startDate,
case when a.cpexdt = 0 then date('2050-12-31')
else
DATE(digits(a.cpexcc) || substr(digits(a.cpexdt),1,2) ||
'-' || substr(digits(a.cpexdt),3,2) ||
'-' || substr(digits(a.cpexdt),5,2)) end expireDate,
a.cpcnqt cnqt, a.cpprbk prbk
from contr a
where length(trim(a.cpcsid)) = 10 ;
--
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=y3Wi9KB1RnzjMQRq8m_v-
GIT1TYSPNX9Tgetl-uVjQg&s=HpgyDBKzoBphSPbwC3_1yJmSUeGPuwgXLhif5nFXnwM&e=siA1ZOg&r=oCmVbiwufH6yM8U29GriOcB5LKDoEG8y1HZD-01RVtc&m=y3Wi9KB1RnzjMQRq8m_v-
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
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-
GIT1TYSPNX9Tgetl-uVjQg&s=arTJzLJlTTkmGIIBwTBZFqDYH50M3MLijXu8iHPgOSg&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=y3Wi9KB1RnzjMQRq8m_v-
u=https-3A__amazon.midrange.com&d=DwICAg&c=jf_iaSHvJObTbx-
GIT1TYSPNX9Tgetl-uVjQg&s=epPh8RpNNVTRsv6v0bfzwe3v8-kl-o2wrv3AwMuGSm0&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.