Oracle 模糊查找问题 like

来源:百度知道 编辑:UC知道 时间:2024/05/30 20:27:55
想在一个table里找出productid是以大写P开头,后面全是数字的数据,例如,,P001,P002,P3,而像PP,PP0,P00P这些都不算.MY SQL里好像可以用正则表达式,但oralce里不知道如何做.
MY SQL 可以用select * from 表 where 列 like '%值%' ..
Oracle 10可以用like 'P[0-9][0-9][0-9]' OR 'P[0-9][0-9]' OR 'P[0-9]' ..
但我是用Oracle 9

select * from table
where col like 'P%'
and translate(col,'P1234567890','P') = 'P'

select * from 表 where 列 like '%值%'

也可用正则表达式

SELECT * FROM TABLE WHERE 列 like 'P[0-9][0-9][0-9]' OR 'P[0-9][0-9]' OR 'P[0-9]'