日期:2014-05-17 浏览次数:21242 次
PROCEDURE PROCESS_ITEM_EXP_STATUS_UPD(in_inquiry_id IN inquire_all.inquiry_id%TYPE, in_item_populate_status IN inquire_all.item_populate_status%TYPE) IS v_CurMonth number; v_PrevMonth number; v_cursor number; v_row number; BEGIN v_CurMonth := to_number(to_char(sysdate, 'MM')); IF (v_CurMonth=1) THEN v_PrevMonth := 12; ELSE v_PrevMonth := v_CurMonth -1; END IF; BEGIN v_cursor := dbms_sql.open_cursor; /*dbms_sql.parse(v_cursor, 'UPDATE INQUIRE_' || v_PrevMonth || v_sqlStr, dbms_sql.NATIVE);*/ /*dbms_sql.parse(v_cursor, 'UPDATE G3WEB.INQUIRE_ALL_2 SET ITEM_POPULATE_STATUS = '||[color=#FF0000]in_item_populate_status[/color] ||',ITEM_POPULATE_DATE = sysdate WHERE INQUIRY_ID = '||in_inquiry_id || ' AND FORM_COMPLETE_STATUS = ''Y''', dbms_sql.NATIVE);*/ dbms_sql.parse(v_cursor, 'UPDATE INQUIRE_' || v_PrevMonth ||' SET ITEM_POPULATE_STATUS = ' || in_item_populate_status || ' , ITEM_POPULATE_DATE = sysdate WHERE INQUIRY_ID = '||in_inquiry_id || ' AND FORM_COMPLETE_STATUS = ''Y''', dbms_sql.NATIVE); v_row := dbms_sql.execute(v_cursor); dbms_sql.close_cursor(v_cursor); EXCEPTION WHEN others THEN dbms_sql.close_cursor(v_cursor); RAISE_APPLICATION_ERROR(-20200, '22Error in updating table [INQUIRE_'||v_PrevMonth ||'] SQLERROR: ' || SQLERRM(sqlcode)); END; COMMIT; END PROCESS_ITEM_EXP_STATUS_UPD;