Question

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

Était-ce utile?

La solution

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';
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top