DELETE UserDB..UserAccount
FROM UserDB..UserAccount A, CustDB..ETS_Profile B
WHERE A.UserId = B.User_Id
and B.Category = 'Customer'
AND B.Sub_Category = 'Teir'
and B.Item_Name = 'CUSTODIAN'
以上是Sybase查询,效果很好。我正在为UserDB创建一个处理程序并在Oracle中执行此查询
在oracle中,如果我提供如下查询,我会收到错误
DELETE UserAccount
FROM UserAccount A,CustDB.ETS_Profile B
where A.UserId = B.User_Id
and B.Category = 'Customer'
and B.Sub_Category = 'Teir'
and B.Item_Name = 'CUSTODIAN';
答案 0 :(得分:4)
您应该按如下方式制定查询:
DELETE FROM UserAccount A
WHERE EXISTS
( SELECT NULL
FROM CustDB.Ets_Profile B
WHERE B.user_id = A.UserId
AND B.Category = 'Customer'
AND B.Sub_Category = 'Teir'
AND B.Item_Name = 'CUSTODIAN'
);