user2993998 user2993998 - 6 months ago 19
SQL Question

Oracle merge command - missing keyword

I'm trying to use the Oracle MERGE command and am getting an error saying ORA-00905: missing keyword

The query I'm trying is as follows

MERGE INTO vor_extract v USING
(SELECT dealer, wip_no,
required_date, required_time
FROM vor_extract_temp
) t
ON (v.dealer = t.dealer AND v.wip_no = t.wip_no)
WHEN MATCHED THEN
UPDATE
SET v.required_date = t.required_date,
v.required_time = t.required_time;


any clues anyone?

It's probably something simple as I've not used the MERGE statement before so am no doubt just missing something

Thanks all

Answer

Generally, the syntax seems valid. But in case you are using oracle versions earlier than 10g, the

 WHEN NOT MATCHED ...

clause is also mandatory