Reputation: 145
I have an issue in converting a character varying(20) to bigint and checking the range for example in the where clause I have:
where k.broj::bigint >= 402099 and k.broj::bigint <= 4020991112649
this gives me an error
ERROR: invalid input syntax for integer: ""
********** Error **********
ERROR: invalid input syntax for integer: ""
SQL state: 22P02
Upvotes: 2
Views: 4479
Reputation:
An empty string is not a valid number, you need to convert that to null, e.g.
where nullif(k.broj,'')::bigint >= 402099
and nullif(k.broj,'')::bigint <= 4020991112649
Upvotes: 2