【问题标题】:ora-30926 error [duplicate]ora-30926 错误 [重复]
【发布时间】:2012-04-15 01:25:39
【问题描述】:

可能重复:
ORA-30926: unable to get a stable set of rows in the source tables

我正在尝试执行以下合并语句,但显示 ora-30926 错误

merge into test_output target_table 
USING (SELECT c.test_code, 
  c.v_report_id, upper_score,
        CASE WHEN c.test_code = 1 THEN b.mean_diff 
             WHEN c.test_code = 2 THEN b.norm_dist 
             WHEN c.test_code = 3 THEN b.ks_stats 
             WHEN c.test_code = 4 THEN b.ginni 
             WHEN c.test_code = 5 THEN b.auroc 
             WHEN c.test_code = 6 THEN b.info_stats 
             WHEN c.test_code = 7 THEN b.kl_stats 
                    END val1 
     FROM   combined_approach b inner join test_output c
          on  b.v_report_id = c.v_report_id 
          and c.upper_score = b.band_code 
             WHERE c.v_report_id = lv_report_id  
                        ORDER  BY c.test_code) source_table
                        on(target_table.v_report_id = source_table.v_report_id
                        and  target_table.v_report_id = lv_report_id)
                when matched then         
update  SET    target_table.upper_value = source_table.val1;

【问题讨论】:

标签: sql oracle merge


【解决方案1】:

我认为您有此错误,因为您的行在 using 子句中具有相同的 v_report_id 你可以试试这个

merge into test_output target_table 
USING (SELECT 
        CASE WHEN c.test_code = 1 THEN b.mean_diff 
             WHEN c.test_code = 2 THEN b.norm_dist 
             WHEN c.test_code = 3 THEN b.ks_stats 
             WHEN c.test_code = 4 THEN b.ginni 
             WHEN c.test_code = 5 THEN b.auroc 
             WHEN c.test_code = 6 THEN b.info_stats 
             WHEN c.test_code = 7 THEN b.kl_stats 
                    END val1 
     FROM   combined_approach b inner join test_output c
          on  b.v_report_id = c.v_report_id 
          and c.upper_score = b.band_code 
             WHERE c.v_report_id = lv_report_id  
              group by v_report_id          
) source_table
on (target_table.v_report_id = source_table.v_report_id
    and  target_table.v_report_id = lv_report_id)
when matched then update  
   SET   target_table.upper_value = source_table.val1;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-05-03
    • 2013-10-08
    • 1970-01-01
    • 2019-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-27
    相关资源
    最近更新 更多