As part of "pandemic planning" at work, I'm trying to duplicate some
Oracle functionality at home.  I'm running into a problem with the
"WHERE" clause that totally baffles me.  The problem surfaced in a TCL
program, but I can duplicate it from the sqlite3 command prompt, so I'll
use that in this email.  Here's the situation.  I've created a table
called dly04.  Here are the first few columns from the create statement.
Note the 2 columns "national_identifier varchar2(7), local_year integer".

sqlite> select * from sqlite_master where name = 'dly04';
table|dly04|dly04|1042384|CREATE TABLE dly04(i_stnid integer, 
national_identifier varchar2(7),
  local_year integer, local_month integer, local_day integer, etc, etc

  I then imported data from work as tab-delimited.  I can query with
"where" using a character field...

sqlite> select local_year, local_month, local_day from dly04 where 
(national_identifier = '615HMAK');

  The last few rows of the query output are...

 2009|  9| 21
 2009|  9| 22
 2009|  9| 23
 2009|  9| 24
 2009|  9| 25
 2009|  9| 26
 2009|  9| 27
 2009|  9| 28
 2009|  9| 29
 2009|  9| 30

  So I *KNOW* that there are rows with local_year = 2009.  But...

sqlite> select local_year, local_month, local_day from dly04 where (local_year 
= 2009);

...doesn't find any rows at all.  This should be a no-brainer that works
in any SQL-compliant implementation.  Neither do I get any rows with
alternatives like...

 = '2009'  or  == 2009  or  == '2009'

  I'm totally stumped.  I wonder if I'm doing something "the Oracle way"
that isn't 100% SQL-compliant.  One thing I've done is to create an index
like so...

index|d04_ndx_00|dly04|14555880|CREATE INDEX d04_ndx_00 on dly04
(national_identifier, local_year, local_month)

  Is that allowed, or would it screw things up?

-- 
Walter Dnes <waltd...@waltdnes.org>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to