Reputation: 152
SELECT GROUP_ID FROM KM_MAST_GROUP WHERE (OWNER=4629 or CREATED_BY::int=4629)
owner is int and created_by is varchar I am getting error like invalid input syntax for integer: "null" i am not getting how to do the type casting. Anyone help me
Upvotes: 0
Views: 3182
Reputation: 28541
Try following query:
select *
from KM_MAST_GROUP
where CREATED_BY !~ '[0-9]+';
It will give you all rows, where CREATED_BY
is not a number. Fix such rows, and your query will work.
Other way is to use strings instead of integers.
SELECT GROUP_ID
FROM KM_MAST_GROUP
WHERE CREATED_BY = '4629';
Upvotes: 5