Sli*_*lim 5 sql oracle isqlquery
我有一个Date列,实际上不是日期格式.日期如下:25/10/2012.现在我必须比较2个日期,但我找不到这样做的模式,因为格式错误.
我试过的是:
SELECT *
from PARAMETER
where NAME like 'Date_To' and SUBSTR(VALUE, 1, 2)<'25'
and SUBSTR(VALUE, 1, 2)>'05'
Run Code Online (Sandbox Code Playgroud)
我面临的问题是这一部分:SUBSTR(PA_VALUE, 1, 2)>'05'不起作用,因为数字前面有0(零).有什么解决方案吗?
尝试像
SELECT *
from PARAMETER
where NAME like 'Date_To'
and cast ( SUBSTR(VALUE, 1, 2) as int ) <cast ('25' as int)
and cast ( SUBSTR(VALUE, 1, 2) as int) > cast ('05' as int )
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1506 次 |
| 最近记录: |