Postgre varchar field between

Posted by Anton on Stack Overflow See other posts from Stack Overflow or by Anton
Published on 2010-06-10T15:33:56Z Indexed on 2010/06/10 15:53 UTC
Read the original article Hit count: 391

Filed under:
|

I have an addresses table with ZIP code field which has type VARCHAR. I need to select all addresses form this table using ZIP codes range. If I used next code:

select * from address where cast(zip as bigint) between 90210 and 90220

I get an error on fields where ZIP code cann't be cast as bigint.

How I can resolve this issue?

© Stack Overflow or respective owner

Related posts about postgresql

Related posts about sqldatatypes