oracle 10g
数据清洗的要求,要找出一些合法数据.
有test表,字段crotime的数据如下,
123445
abcd
1-02-02
2008-01-01
2008-3-23
08-4-2
02-02现在我想找出下面这样的数据:
2008-01-01
2008-3-23
08-4-2请问应该如写SQL??多谢各位了...在线等.!
数据清洗的要求,要找出一些合法数据.
有test表,字段crotime的数据如下,
123445
abcd
1-02-02
2008-01-01
2008-3-23
08-4-2
02-02现在我想找出下面这样的数据:
2008-01-01
2008-3-23
08-4-2请问应该如写SQL??多谢各位了...在线等.!
SQL> select crotime from test;CROTIME
----------
123445
abcd
1-02-02
2008-01-01
2008-3-23
08-4-2
02-027 rows selectedSQL> select * from test a where REGEXP_LIKE(a.crotime,'^\d{2,4}-\d{1,2}-\d{1,2}$');CROTIME
----------
2008-01-01
2008-3-23
08-4-2SQL>
select * from test where instr(crotime,'-',1,2)>0大伙提供了几种方法,lz自己选合适的哦。