17,377
社区成员
发帖
与我相关
我的任务
分享
select * from 表
where getdate() between '生效时间' and isnull('失效时间','--@@@--')----@@@--要是空的需要看到,这里就写'9999-99-99',否则'0000-00-00'
[/quote]
oracle 好像没 isnull 用decode判断吗[/quote]
[/quote]
受你启发 搞定
AND SYSDATE >= A.EFF_DATE
AND SYSDATE <= DECODE(A.EXP_DATE,NULL,TO_DATE('9999-01-01','YYYY-MM-DD HH24:MI:SS'),A.EXP_DATE)
select * from 表
where getdate() between '生效时间' and isnull('失效时间','--@@@--')----@@@--要是空的需要看到,这里就写'9999-99-99',否则'0000-00-00'
[/quote]
oracle 好像没 isnull 用decode判断吗[/quote]
select * from 表
where getdate() between '生效时间' and isnull('失效时间','--@@@--')----@@@--要是空的需要看到,这里就写'9999-99-99',否则'0000-00-00'
[/quote]
oracle 好像没 isnull 用decode判断吗
select * from table
where sysdate >= start_time
and ((sysdate <= end_time and end_time is not null) or end_time is null)
--start_time生效时间 end_time失效时间
select * from 表
where getdate() between '生效时间' and isnull('失效时间','--@@@--')----@@@--要是空的需要看到,这里就写'9999-99-99',否则'0000-00-00'