I got a dumb question on the merge statement. I read the following
example of merge statement at the IBM page:
MERGE INTO archive ar
USING (SELECT activity, description FROM activities) ac
ON (ar.activity = ac.activity)
WHEN MATCHED THEN
UPDATE SET
description = ac.description
WHEN NOT MATCHED THEN
INSERT
(activity, description)
VALUES (ac.activity, ac.description)
Can't we use activities as the source table directly, as:
MERGE INTO archive ar
USING activities ac
ON (ar.activity = ac.activity)
....
Also, in the original example, if the table activities has an index
on the column activity, can it be utilized since the source table is a
query on the table activities?
Thanks!
Comment