Unknown Error '0' when using BETWEEN in a SQL statement
Posted in 1994
Topics: SQL Development & Query Writing, Connectivity: ESQL/C, 4GL & Embedded SQL, Data Types & Schema Design
Hi, Here's my setup: COMPUTER: AT&T 3B2/522 running Unix SysV 3.2.1 SE: 4.00.UD2 ISQL: 4.00.UD1 I4GL: 4.00.UH1 TABLE ship_info: col_name type ship_name char(30) bale char(10) grain char(10) STATEMENT: select * from ship_info where (bale between "1500000" and "3000000") PROBLEM: When I do the select statement above, I get a record with the bale = "201359". I think I know why this happens; I think the '15' and the '30' at the front of one million five hundred thousand and three million are the culprits. SOLUTIONS I TRIED: 1. Select * from ship_info where (bale >= 1500000 and bale <= 3000000) 2. Select * from ship_info where (bale between "1500000" and "3000000") PROBLEMS WITH THE TWO STATEMENTS ABOVE: I get the Unknown error '0' (yes zero). I'm not sure if it's a syntax problem or something. I read the manual and it says there ... [expr] and [expr]. My questions: 1. What's this error '0'? 2. What's causing error '0'? 3. Is there a way for me to get records between one million five hundred thousand and three million WITHOUT changing the data type of the 'bale' and 'grain' fields? I can't change them because we use '*' if the ship does not have a 'bale' or 'grain' capacity. 4. Any suggestions how to get the correct records? Please E-mail. Thanks! John