我已经并继续在简单的 Oracle SQL 语句中使用通配符。这个不起作用,我真的不知道为什么。下面的 SQL 返回 0 行,但如果我删除通配符“%”,它会按预期返回单行。我本以为这两个语句应该返回相同的结果集:
select * from my_table where ident_num='%98511'; -- No rows
select * from my_table where ident_num='98511'; -- 1 row
select * from my_table where ident_num='%98511'
这将返回具有确切字符串“%98511”的所有行
select * from my_table where ident_num like '%98511'
应该做你想做的事