oracle sql 求种菜时间

来源:互联网 发布:企业名录数据 编辑:程序博客网 时间:2024/04/29 14:02

-- create by zh
-- n 是作物的时间,x 是希望在几点成熟,返回播种的时间

with t as
(
select 64 n,9 x from dual union all
select 64 n,13 x from dual union all
select 64 n,17 x from dual union all
select 64 n,20 x from dual

)
select '成熟时间:'     || lpad(to_char(n),4,' ')                            || '   ;' ||
       '摘取时间:'     || lpad(to_char(x),4,' ')                            || '   ;' ||
       '播种时间:'     || lpad(to_char(mod(24+( x - mod( n,24)),24)),4,' ') || '   ;'
  jg from t
 

原创粉丝点击