有没有高手在,帮忙修改一下

来源:互联网 发布:warframe防火墙udp端口 编辑:程序博客网 时间:2024/04/30 23:57

这段程序,是个判断,总共有4种情况

当dctime=02,04,06,09,11时,to_number(dcNowMonth)-to_number(dcOldMonth)>100,则ntime:=1;
当dctime=05,07,08,10,12时,to_number(dcNowMonth)-to_number(dcOldMonth)>101,则ntime:=1;
当dctime=03时,to_number(dcNowMonth)-to_number(dcOldMonth)>103,则ntime:=1;
当dctime=01时,to_number(dcNowMonth)-to_number(dcOldMonth)>8900,则ntime:=1;

dcNowMonth:=to_char(sysdate,'yyyyMMdd');
   dctime:=to_char(sysdate,'MM');
   select dcmonth into dcOldMonth from month100 where rownum<2;
   while (dctime=02) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>100
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=04) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>100
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=06) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>100
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=09) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>100
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=11) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>100
   then
   ntime:=1;

   end if;
   end loop;
    while (dctime=03) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>103
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=01) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>8900
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=05) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>101
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=07) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>101
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=08) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>101
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=10) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>101
   then
   ntime:=1;
   end if;
   end loop;
    while (dctime=12) loop
   if to_number(dcNowMonth)-to_number(dcOldMonth)>101
   then
   ntime:=1;
   end if;
   end loop;

小弟对数据库的存储过程不熟,哪位帮我修改一下。还有
dctime:=to_char(sysdate,'MM');
是不是取系统日期中的月数。

原创粉丝点击