I have the following oracle statement which some days ago worked quick and fine. When I run it now it takes forever:
MERGE INTO tablef f using
(
select t.colf,t.colup
from tablet t
inner join (select max(created) as maxcreated
from tablet) mt
on t.created = mt.maxcreated) fu
on f.colf = fu.colf
WHEN MATCHED THEN
UPDATE SET f.aus = fu.colup
Or is there a way to reformulate the query to get it running again and faster?
The two tables involved have a primary key. For tablef the primary key is colf and for tablet the primary key is colf and created. Actually I also want to run this query from an SQL server database via an oracle linked server. And when I run this in SQL server management studio as follows:
execute ('MERGE INTO tablef f using
(
select
t.colf,t.colup
from tablet t
inner join (select max(created) as maxcreated from tablet) mt on t.created = mt.maxcreated) fu
on f.colf = fu.colf
WHEN MATCHED THEN
UPDATE SET f.aus = fu.colup') AT ORACLELINKEDSERVER*
it runs without error and says 1 row affected. However if I check the data on the oracle database the row is not updated.