0
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

1 Answer 1

5

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';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.