Reputation: 763
I need to so a sql query on IBM netezza sql database from Aginity workbench on win7.
My query:
SELECT *
from table1 AS c ,
table2 AS b
where CAST(c.id as int) = b.id
in table1, id is character varying(20) and in table2, id is int.
Table1:
id value1 value2
'985' 'casdqwdc' '654.3184' // they are all char
Table2:
id value1
985 694381 // id is int, value1 is int
I got error:
ERROR [HY000] ERROR: pg_atoi: error in "id": can't parse "id"
Any help would be appreciated.
Upvotes: 1
Views: 1821
Reputation: 3887
Somewhere in column ID in table1 there is a value that can't be converted to an integer.
Based on the error, you have probably used nzload or an external table to load a data file that has a header row with column labels without skipping that row, and you have 1 row with the value 'ID' in the column ID.
TESTDB.ADMIN(ADMIN)=> select CAST('ID' as int);
ERROR: pg_atoi: error in "ID": can't parse "ID"
Upvotes: 1