This process is a judgment, there are 4 cases.
When DCTIME = 02, 04, 06, 09, 11, TO_NUMBER (DCNOWMONTH) - TO_NUMBER (DCOLDMONTH)> 100, NTIME: = 1; When DCTIME = 05, 07, 08, 10, 12, TO_NUMBER (DCNOWMONTH) -to_number (dcoldMonth)> 101, ntime: = 1; When DCTIME = 03, TO_NUMBER (DCNOWMONTH) -TO_NUMBER (DCOLDMONTH)> 103, ntime: = 1; When DCTIME = 01, TO_NUMBER (DCNOWMONTH) -TO_NUMBER (DCOLDMONTH)> 8900, then 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; The store's stored procedure is not familiar, which help me modify. There is also DCTIME: = to_CHAR (sysdate, 'mm'); is not the number of months in the system date.