BEGIN FOR L_RECORD IN (select RECORD_ID,CURR_PERIOD,PERIOD_START_DATE,(sysdate- PERIOD_START_DATE) diffTime,(P.PERIOD_END_DAY-P.PERIOD_BEGIN_DAY) periodDiffDay from CPS_PATIENT_PATH_RECORD t1 inner join cps_treat_period p on p.Period_Id=t1.Curr_Period where t1.path_state=1) LOOP IF (L_RECORD.DIFFTIME >=L_RECORD.periodDiffDay) THEN UPDATE CPS_PATIENT_PATH_RECORD SET PERIOD_START_DATE=to_date(to_char(sysdate,'YYYY/MM/DD'),CURR_PERIOD =L_RECORD.CURR_PERIOD+1 WHERE RECORD_ID=L_RECORD.RECORD_ID; END IF; END LOOP; END;
格式:
FOR record IN (SELECT)
LOOP
UPDATE T WHERE
END LOOP
原文链接:https://www.f2er.com/oracle/210184.html