I'm trying to insert or update a record in a table. I found the MERGE
statement while googling.
The table has manifest# and cnt (qty) and some other fields that don't
matter. Here is my statement. Once I get this to work, I'll replace the
values and the where with variables.
MERGE INTO boxdetwk AS b1
USING (SELECT * from boxdetwk
where manifest = 93000022
) AS b2
ON (b1.manifest = b2.manifest)
WHEN MATCHED THEN
UPDATE SET b1.cnt = b1.cnt + 9999
WHEN NOT MATCHED THEN
INSERT (manifest,cnt)
VALUES (93000022, 1)
When I run this in interactive SQL, I get the below message Row not found
for MERGE. What am I doing wrong? Thank you.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.