with dgsx_t as
(select pcmc no,
to_date(to_char(xssqksrq,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') s,
to_date(to_char(xssqjsrq,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') e
from t_sxgl_dgsxpc),
dgsx_t1 as
(select no, s, e,
case
when to_char(s, 'hh24') < '0' then
case
when to_char(e, 'hh24') < '0' then
case
when to_char(e, 'hh24') <= to_char(s, 'hh24') then ceil(e - s) + 1
else ceil(e - s)
end
when to_char(e, 'hh24') = '0' then ceil(e - s)
else ceil(e - s) + 1
end
when to_char(s, 'hh24') = '0' then ceil(e - s)
else
case
when to_char(e, 'hh24') <= '0' then ceil(e - s)
else
case
when to_char(e, 'hh24') <= to_char(s, 'hh24') then ceil(e - s) + 1
else trunc(e - s) + 1
end
end
end cc
from dgsx_t),
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载