CREATE OR REPLACE
PROCEDURE "UNASSIGN_CUSTOMER_FEATURES"
(CustomerID_Param IN NUMBER, FeatureID_Param IN NUMBER, WalletID_Param IN NUMBER)
AS
BEGIN
DELETE FROM CUSTOMER_EXTRA_FEATURES WHERE FEATURES_ID = FeatureID_Param
AND CUSTOMER_ID = CustomerID_Param;
MERGE INTO CUSTOMER_SERVICE_CONFIG c
USING
(SELECT BUSINESS_SERVICE_CONFIG.ID from BUSINESS_SERVICE_CONFIG join SERVICE_CONFIG_MAP
ON BUSINESS_SERVICE_CONFIG.Business_SERVICE_TYPE = SERVICE_CONFIG_MAP.Service_type_ID
and BUSINESS_SERVICE_CONFIG.ORGANIZATION_ID = WalletID_Param
and BUSINESS_SERVICE_CONFIG.BUSINESSSERVICECATEGORY = 0
and SERVICE_CONFIG_MAP.FEATURES_ID = FeatureID_Param) ids
ON (c.SERVICE_CONFIG_ID = ids.ID and c.CUSTOMER_ID = CustomerID_Param)
WHEN MATCHED THEN
DELETE WHERE CUSTOMER_ID = CustomerID_Param AND SERVICE_CONFIG_ID = ids.ID;
END;
0
A
回答
0
你正在做一個DELETE
像
WHEN MATCHED THEN
UPDATE SET <some field> with <some value>
DELETE WHERE CUSTOMER_ID = CustomerID_Param AND SERVICE_CONFIG_ID =ids.ID;
END;
之前缺少一個UPDATE語句成功
請參閱以下網址: Oracle sql merge to insert and delete but not update
希望幫助!
0
The syntax diagram for the merge statement表明你的delete
條款是update
的可選部分,而不是獨立的:
你得到「ORA-00905:缺少關鍵字」錯誤,因爲你不知道有一個update
。您可以放入一個虛擬更新,但看起來您確實希望刪除所有匹配的行,而不更新其他行或插入新行;這將是作爲一個普通的delete
簡單,類似:
DELETE FROM CUSTOMER_SERVICE_CONFIG c
WHERE CUSTOMER_ID = CustomerID_Param
AND SERVICE_CONFIG_ID IN (
SELECT BUSINESS_SERVICE_CONFIG.ID from BUSINESS_SERVICE_CONFIG join SERVICE_CONFIG_MAP
ON BUSINESS_SERVICE_CONFIG.Business_SERVICE_TYPE = SERVICE_CONFIG_MAP.Service_type_ID
and BUSINESS_SERVICE_CONFIG.ORGANIZATION_ID = WalletID_Param
and BUSINESS_SERVICE_CONFIG.BUSINESSSERVICECATEGORY = 0
and SERVICE_CONFIG_MAP.FEATURES_ID = FeatureID_Param);
或
DELETE FROM CUSTOMER_SERVICE_CONFIG c
WHERE CUSTOMER_ID = CustomerID_Param
AND EXISTS (
SELECT null from BUSINESS_SERVICE_CONFIG join SERVICE_CONFIG_MAP
ON BUSINESS_SERVICE_CONFIG.Business_SERVICE_TYPE = SERVICE_CONFIG_MAP.Service_type_ID
and BUSINESS_SERVICE_CONFIG.ORGANIZATION_ID = WalletID_Param
and BUSINESS_SERVICE_CONFIG.BUSINESSSERVICECATEGORY = 0
and SERVICE_CONFIG_MAP.FEATURES_ID = FeatureID_Param
WHERE BUSINESS_SERVICE_CONFIG.ID = c.SERVICE_CONFIG_ID);
相關問題
- 1. 如果我編譯Java程序,我得到這個錯誤
- 2. 當我運行我在eclipse的Android應用程序,我得到這個錯誤
- 3. 我得到這個錯誤,當我嘗試運行我的Android應用程序
- 4. 當我運行我的應用程序時,出現錯誤編譯錯誤?
- 5. 當我按地址過濾我得到這個錯誤:語法錯誤:後「缺少操作數」運營商
- 6. 如果我編譯我使用的Java程序,我得到這個錯誤,?
- 7. 缺少編譯錯誤Microsoft.WindowsAzure.ServiceRuntime.RoleEntryPoint
- 8. g ++編譯錯誤:缺少';'
- 9. 當我寫這行到flex代碼,我得到這個錯誤:
- 10. 我得到Mongoid ::錯誤:: NoSessionsConfig:錯誤,當我運行rspec
- 11. GCC編譯我得到這些錯誤的錯誤
- 12. 在我的phpmyadmin當我使用這個程序我得到這個SQL錯誤
- 13. 當運行Android應用程序,我得到亞行錯誤
- 14. 我得到這個錯誤
- 15. 運行一個編譯好的Haskell程序;得到錯誤
- 16. 我在sqldeveloper中試過這個查詢,但沒有奏效。我得到了「缺少關鍵字」的錯誤
- 17. SQL錯誤:缺少關鍵字?
- 18. ORA-00905:缺少關鍵字的錯誤
- 19. ORACLE PL/SQL關鍵字缺少錯誤
- 20. CROSS APPLY給缺少關鍵字錯誤
- 21. SQL中缺少關鍵字錯誤?
- 22. ORA-00905缺少關鍵字錯誤
- 23. SQL錯誤 - VALUES關鍵字缺少
- 24. 錯誤:ORA-00905:缺少關鍵字
- 25. 爲什麼我一直得到一個缺少符號的編譯錯誤?
- 26. 燒瓶錯誤當我運行程序
- 27. C2280錯誤,當我運行程序
- 28. android-如何運行程序,當我得到錯誤
- 29. ORA-00926:缺少VALUES關鍵字錯誤。我該怎麼辦?
- 30. 當我嘗試運行我的WEB應用我得到這個錯誤
OK感謝很多工程:) –