天天看點

Oracle删除視圖中的資料

CREATE OR REPLACE PROCEDURE "INDI_DEL_PRO" (IDPARA IN INDIVIDUALVIEW.ID%TYPE, CATEGORYPARA IN INDIVIDUALVIEW.CATEGORY%TYPE, RETURNPARA OUT NUMBER)
AS
APPLYNO INDIVIDUALVIEW.APPLY_NO%TYPE;
BEGIN
  SELECT COUNT(*) INTO RETURNPARA FROM INDIVIDUALVIEW WHERE ID=IDPARA AND CATEGORY=CATEGORYPARA;
  SELECT APPLY_NO INTO APPLYNO FROM INDIVIDUALVIEW WHERE ID=IDPARA AND CATEGORY=CATEGORYPARA;
  IF    CATEGORYPARA= '1001'THEN
        DELETE FROM SSC_EVECT_LOAN_INFO WHERE ID=IDPARA;
        DELETE FROM SSC_DAILY_LOAN_DETAIL_INFO WHERE ID=APPLYNO;
  ELSIF CATEGORYPARA= '1002'THEN
        DELETE FROM SSC_DAILY_LOAN_INFO WHERE ID=IDPARA;
  ELSIF CATEGORYPARA= '1003'THEN
        DELETE FROM SSC_EVECT_EXPENSE_INFO WHERE ID=IDPARA;
        DELETE FROM SSC_EVECT_EXPENSE_DETAIL_INFO WHERE ID=APPLYNO;
  ELSIF CATEGORYPARA= '1004'THEN
        DELETE FROM SSC_DAILY_EXPENSE_INFO WHERE ID=IDPARA;
        DELETE FROM SSC_DAILY_LOAN_DETAIL_INFO WHERE ID=APPLYNO;
  END IF;
END;