|
On 17/01/2007, at 11:12 PM, mcrangle@xxxxxxxxxxxxxxxxxxxx wrote:
I thought this would work, as there is no syntax error using double quotesD SelectOne S 500A INZ('SELECT ITNBR, ITDSC, - D ITTYP - D FROM AMFLIB/ITEMASA - D WHERE SUBSTR(FIL44,43,1)="R" - D ORDER BY') But no records are selected on the OPEN MYCSR, but when I comment the substr D spec, it retrieves ALL records.
If you look up the error code you'll find -206 is Column &1 not found in specified tables. Why? because you used "R". Double quotes make it a column name. Why? RTFM. Since you want to compare against a character string you need to use single quotes, that is, 'R'. Since the quoted string is inside another quoted string (the SQL statement) you need to escape the embedded single quotes by doubling them. Not by using a DOUBLE QUOTE but rather two SINGLE QUOTES. This is basic string handling and nothing special with SQL.
Regards, Simon Coulter. -------------------------------------------------------------------- FlyByNight Software OS/400, i5/OS Technical Specialists http://www.flybynight.com.au/ Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ Fax: +61 3 9419 0175 \ / X ASCII Ribbon campaign against HTML E-Mail / \ --------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.