Hello, I'm trying to use hexadecimal numbers in a where clause and it seems things aren't quite working as expected. I get unknown token errors or inequalities don't return the correct answer.
I have one value set: sqlite> SELECT HEX(minMAC) FROM manifests; 00C100000000 All works as expected with some simple tests: sqlite> SELECT HEX(minMAC) FROM manifests WHERE minMAC <= X'00D100000000'; 00C100000000 sqlite> SELECT HEX(minMAC) FROM manifests WHERE minMAC >= X'00D100000000'; Let's try a small number: sqlite> SELECT HEX(minMAC) FROM manifests WHERE minMAC <= X'04'; 00C100000000 [Wrong -- x'04' < x'00C100000000'] Let's try another small number: sqlite> SELECT HEX(minMAC) FROM manifests WHERE minMAC <= X'04421'; SQL error: unrecognized token: "X'04421'" [What's malformed about this compared to above?] So, can anyone explain to me how I can do inequalities with hexadecimal values; and why some values cause an "unrecognized token" error? Thank you, Clay P.S. Double escaping as is sometimes needed for BLOB objects as per: http://www.mail-archive.com/sqlite-users@sqlite.org/msg27502.html This seems wrong from this output though: sqlite> SELECT HEX(minMAC) FROM manifests WHERE minMAC <= "X'00D100000000'"; [Wrong as I would expect x'00C100000000' < "x'00D100000000'" (Is this a string interpretation?)] sqlite> SELECT HEX(minMAC) FROM manifests WHERE minMAC >= "X'00D100000000'"; 00C100000000 [But at least it seems that x'00C100000000' > "x'00D100000000'" consistently] P.P.S. I've tested this with minMAC being an integer or a blob type. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users