我有一个表table_a 里面有一个字段field中保存了用户的编号,编号使用逗号隔开,例如:379,380,386,390,503我做查询select * from user where user_id in (379,380,386,390,503); 是正确的。 但是当我查询 select * from user where user_id in (select field from table_a where id = 1);时却报oracle ORA-01722无效数字
答:select * from user where INSTR( (select ',' || field || ',' from table_a where id = 1), ',' || TRIM(TO_CHAR(user_id )) || ',' ) > 0