I want to convert column type from varchar to integer in postgresql
ALTER TABLE billdetail ALTER COLUMN masterid TYPE integer;
gives
[Err] ERROR: column "masterid" cannot be cast automatically to type integer
HINT: You might need to specify "USING masterid::integer".
while
ALTER TABLE billdetail USING masterid::integer;
gives
[Err] ERROR: syntax error at or near "USING"
LINE 1: ALTER TABLE billdetail USING masterid::integer;
How can I fix this problem?