- 最后登录
- 2013-11-17
- 在线时间
- 24 小时
- 威望
- 53
- 金钱
- 364
- 注册时间
- 2012-3-14
- 阅读权限
- 50
- 帖子
- 37
- 精华
- 0
- 积分
- 53
- UID
- 297
|
2#
发表于 2012-5-3 16:01:43
你们的数据库版本是多少?如果是10g及以上,可以用正则表达式来实现。
请看例子:
WITH s AS (
SELECT 1 AS ID,'a23' AS grade FROM dual
UNION ALL
SELECT 2 AS ID,'2a3.33' AS grade FROM dual
UNION ALL
SELECT 3 AS ID,'23.333' AS grade FROM dual
UNION ALL
SELECT 4 AS ID,'23' AS grade FROM dual
UNION ALL
SELECT 5 AS ID,'23.23' AS grade FROM dual
UNION ALL
SELECT 5 AS ID,'23.2a3' AS grade FROM dual
)
SELECT * FROM s
WHERE regexp_like(grade,'^[0-9]{1,}($|\.[0-9]{1,2}$)') |
|