gpt4 book ai didi

sql - 运行合并到查询时出现 ORA-30926 错误

转载 作者:行者123 更新时间:2023-12-04 06:42:24 26 4
gpt4 key购买 nike

此查询出现错误:

 MERGE INTO edw_clctns_equip_dim d
USING psa_equipment_status_history
ON ( dw_equipment_id = TO_NUMBER (d.clctns_equip_source_id)
AND d.active_ind = 'Y')
WHEN MATCHED THEN
UPDATE
SET clctns_initial_status_date =
(SELECT MIN (effective_date)
FROM psa_equipment_status_history
WHERE dw_equip_status_type_id IN (
SELECT dw_equip_status_type_id
FROM psa_equipment_status_type
WHERE equipment_status_code = '100')
AND current_flag = 'Y'
AND iud_flag <> 'D'
AND dw_equipment_id = TO_NUMBER (d.clctns_equip_source_id))

我可以使用简单的更新查询,但它花费的时间太长。合并语句有帮助吗?
Update EDW_CLCTNS_EQUIP_DIM d
Set CLCTNS_INITIAL_STATUS_DATE =
( SELECT
MIN(EFFECTIVE_DATE)
FROM PSA_EQUIPMENT_STATUS_HISTORY
WHERE DW_EQUIP_STATUS_TYPE_ID In
( Select DW_EQUIP_STATUS_TYPE_ID
From PSA_EQUIPMENT_STATUS_TYPE
Where EQUIPMENT_STATUS_CODE = '100'
)
AND CURRENT_FLAG = 'Y'
AND IUD_FLAG<>'D'
AND DW_EQUIPMENT_ID=to_number(d.CLCTNS_EQUIP_SOURCE_ID)
);

最佳答案

看看对ORA-30926: unable to get a stable set of rows in the source tables的回答:

This is usually caused by duplicates in the query specified in USING clause.
...



由于我的评论似乎解决了您的问题,因此我将其发布为答案。

关于sql - 运行合并到查询时出现 ORA-30926 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4077225/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com