|
Try some derivative of: select mychar, nbrdate from rob/rick where (CASE WHEN nbrdate=' ' then 0 ELSE days(substr(nbrdate, 1, 4) || '-' || substr(nbrdate, 5, 2) || '-' || substr(nbrdate, 7, 2)) END) > (days(char(curdate())) - 365) order by mychar desc, nbrdate Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Chevalier, Rick" <Rick.Chevalier@americredit.com> Sent by: midrange-l-bounces@midrange.com 02/06/2003 04:57 PM Please respond to Midrange Systems Technical Discussion To: "Midrange Mailing List (E-mail)" <midrange-l@midrange.com> cc: Fax to: Subject: SQLerror on field but shouldn't reference it I am receiving an error running the following SQL statement: select lnnote, lnstat, lnpnbr from lnp00301 where lnstat <> 'C' or lnnote in (select lnnote from lnp00301 where (lnstat = 'C' and days(substr(lnpnbr, 1, 4) || '-' || substr(lnpnbr, 5, 2) || '-' || substr(lnpnbr, 7, 2)) > (days(char(curdate())) - 365))) order by lnstat desc, lnpnbr The error I receive is 'Selection error involving field LNPNBR.' Displaying the message identifies the record number and refers me to the job log. The job log contains this message: Message ID . . . . . . : CPD4019 Severity . . . . . . . : 10 Message type . . . . . : Diagnostic Date sent . . . . . . : 02/06/03 Time sent . . . . . . : 15:31:34 Message . . . . : Select or omit error on field LNPNBR member LNP00301. Cause . . . . . : A select or omit error occurred in record 1042912, record format LNP0031, member number 1 of file LNP00301 in library BNKPRD08, because of condition 6 of the following conditions: 6 - A data mapping error occurred on the field before the select or omit operation was attempted. The values for record 1042912 are: Record# LNBK LNNOTE LNSTAT LNPNBR 1042912 8 123456789 My question is this. I realize that LNPNBR is blank for this record and would not be valid for the days function in the subselect but the LNSTAT field is blank also so it would pass the initial test of LNSTAT <> 'C'. Why is SQL trying to perform a numeric operation on this record? It seems to me that it would stop after passing the LNSTAT <> 'C' test. What am I missing? Rick Chevalier Sr. Programmer Analyst rick.chevalier@americredit.com _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
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.