title: ORA-01799: a column may not be outer-joined to a subquery with insert statement
body: <p>I am trying to create this procedure:</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE USP_DAILY_REP_REG_REFRESH
  IS
  BEGIN
  
    SAVEPOINT start_tran;
    EXECUTE immediate 'truncate table rep_fir_acts';
  
    --  Insert Query
    INSERT
    INTO rep_fir_acts
      (
        PS_CD,
        LANG_CD,
        FIR_REG_NUM,
        FIR_DT,
        ACT_CD,
        PEND_INV_FIR_NUM,
        FINAL_REP_SRNO,
        CHARGESHEET_DT,
        INVTG_STATUS_CD,
        FR_TYPE_CD,
        FINAL_REPORT_TYPE_CD,
        PEND_TRIAL_FIR,
        DISPOSAL_NATURE_CD,
        ACTION_TAKEN_CD,
        FIR_STATUS
      )
    SELECT DISTINCT F.PS_CD,
      F.LANG_CD,
      F.FIR_REG_NUM,
      F.REG_DT FIR_DT,
      C.ACT_CD ,
      fnl.FIR_REG_NUM PEND_INV_FIR_NUM,
      fnl.FINAL_REP_SRNO ,
      fnl.CHARGESHEET_DT,
      fnl.INVTG_STATUS_CD,
      fnl.FR_TYPE_CD,
      fnl.FINAL_REPORT_TYPE_CD ,
      dis.FIR_REG_NUM PEND_TRIAL_FIR,
      dis.DISPOSAL_NATURE_CD ,
      f.ACTION_TAKEN_CD,
      f.FIR_STATUS
    FROM t_fir_registration f
    INNER JOIN t_crime_act_section c
    ON f.fir_reg_num = c.fir_reg_num
    AND f.lang_cd    = c.lang_cd
    INNER JOIN t_crime_detail cd
    ON c.fir_reg_num      = cd.fir_reg_num
    AND c.lang_cd         = cd.lang_cd
    AND c.CRM_DETAIL_SRNO = cd.CRM_DETAIL_SRNO
    AND cd.RECORD_STATUS  = 'C'
    LEFT JOIN t_final_report fnl
    ON f.fir_reg_num            = fnl.fir_reg_num
    AND f.lang_cd               = fnl.lang_cd
    AND IS_CHARGESHEET_ORIGINAL = 'Y'
    AND fnl.final_rep_srno     IN
      (SELECT MAX(final_rep_srno)
      FROM t_final_report fn
      WHERE f.fir_reg_num            = fn.fir_reg_num
      AND f.lang_cd                  = fn.lang_cd
      AND fn.IS_CHARGESHEET_ORIGINAL = 'Y'
      )
    LEFT JOIN t_court_disposal dis
    ON f.fir_reg_num       = dis.fir_reg_num
    AND dis.DISPOSAL_SRNO IN
      (SELECT MAX(DISPOSAL_SRNO)
      FROM t_court_disposal cdis
      WHERE dis.fir_reg_num = cdis.fir_reg_num
      )
    WHERE c.act_cd       &lt;&gt; 0
    AND f.fir_status NOT IN(2,20,104,103);
  EXCEPTION
  WHEN OTHERS THEN
    ROLLBACK TO start_tran;
    RAISE;
  END;
  </code></pre>
  
  <p>When I try to run this I get:</p>
  
  <pre><code>  PL/SQL: SQL Statement ignored
    ORA-01799: a column may not be outer-joined to a subquery with insert
    statement               
  </code></pre>
  
  <p>How can I resolve this problem?</p>