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'
The above is a Sybase query which works well. I am creating a handler for UserDB and executing this query in Oracle
In oracle I am getting errors if i give the query as below
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';
You should probably formulate the query as below:
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'
);
精彩评论