更新Oracle中的查询抛出临时空间问题

时间:2019-02-07 10:45:57

标签: oracle

在大数据运行时,以下查询会抛出临时空间错误(无法增加临时空间)。我认为问题在于查询的编写方式。有人可以帮助您更有效地重写查询:

UPDATE  TABLE1 tab 
SET tab.tgt_col = 1
WHERE tab.id1 IN (
      SELECT 
      Id1 FROM  TABLE1 t1 WHERE
      t1.id1 NOT IN ( SELECT Min(id1) FROM  TABLE1 t2
                      WHERE t2.date_col= :A
                      AND t1.col1 = t2.col2
                      AND t1.col2 =t2.col2
                      AND t1.col3 =t2.col3
                      AND t1.col4 =t2.col4
                      AND Nvl(t1.col5, 'XX') =Nvl(t2.col5, 'XX')
                      AND t1.col6 = t2.col6
                       AND t1.col7 = t2.col7
                       AND To_Char(t1.col_time,'YYYYMMDD') = To_Char(t2.col_time,'YYYYMMDD')
                      )
      AND t1.col7  IN('a','b','c')
      AND t1.date_col = :A
      AND t1.COUNTRY IN ('US','CA')
      AND t1.col1 IN (SELECT col1 FROM table2 F
                                    WHERE F.col8 IN (SELECT col8 FROM table3
                                                                    WHERE date_col=:A AND col9 = 1 )
                                                                                AND F.col10 = '1')
      )
AND  tab.date_col = :A;

0 个答案:

没有答案