I'm with a problem in PostgreSQL. I need to do something like this:
select * from single_occurrences
where
age::int4 > 29
And I got this error:
ERROR: invalid input syntax for integer: ""
The field age is a text field. How can I convert all the "" va开发者_Python百科lues to NULL values?
Best Regards,
SELECT *
FROM single_occurrences
WHERE CASE WHEN age="" THEN NULL ELSE age::int4 END > 29
UPDATE single_occurrences SET age=NULL WHERE age="";
精彩评论