日期:2014-05-17 浏览次数:21619 次
DECLARE v_date DATE; v_errmsg VARCHAR2(1000); BEGIN FOR arec IN (SELECT AIC081 FROM xrsiqj.ic02 WHERE aac001 = '8')LOOP BEGIN IF LENGTH(arec.aic081) = 6 THEN v_date := to_date(arec.aic081,'yyyymm'); ELSIF LENGTH(arec.aic081) = 10 THEN v_date := to_date(arec.aic081,'yyyymmdd'); ELSE v_date := '1234'; END IF; dbms_output.put_line(v_date); EXCEPTION WHEN OTHERS THEN v_errmsg := SQLERRM; dbms_output.put_line(v_errmsg); END; END LOOP; END;