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

4

1 回答 1

5

尝试以下查询:

select *
from KM_MAST_GROUP 
where CREATED_BY !~ '[0-9]+';

它将为您提供所有行,其中CREATED_BY不是数字。修复此类行,您的查询将起作用。

另一种方法是使用字符串而不是整数。

SELECT GROUP_ID 
FROM KM_MAST_GROUP 
WHERE CREATED_BY = '4629';
于 2013-10-29T10:26:30.703 回答