SQLite Forum

Triggers
Login
Hi To,

Is it an idea to abbreviate this:

CHECK (SUBSTR(VIN,3,1) =='X' OR SUBSTR(VIN,3,1) == '0' OR SUBSTR(VIN,3,1) == '1' OR SUBSTR(VIN,3,1) == '2' OR SUBSTR(VIN,3,1) == '3' OR SUBSTR(VIN,3,1) == '4' OR SUBSTR(VIN,3,1) == '5' OR SUBSTR(VIN,3,1) == '6' OR SUBSTR(VIN,3,1) == '7' OR SUBSTR(VIN,3,1) == '8' OR SUBSTR(VIN,3,1) == '9')

to
CHECK (SUBSTR(VIN,3,1) IN (X', '0', '1', '2', '3', '4', '5', '6','7'.0 '8','9') 

which is more readable but not more efficient!

Although, I think that regular expressions will do a better job in these cases.