× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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.

Message ID . . . . . . : SQL0100 Severity . . . . . . . : 00

Message type . . . . . : Information



Message . . . . : Row not found for MERGE.

Cause . . . . . : One of the following conditions has occurred:

-- If this is a FETCH statement, no more rows satisfy the selection
values
(end of file). The name of the cursor is MERGE and the result set

identifier is 0. If the result set identifier is non-zero, the result
table
for this cursor was being accessed as a stored procedure result set.

-- If this is a FETCH statement for a scrollable cursor, a record was
not
found. If NEXT was specified, end of file was reached. If PRIOR was

specified, the beginning of the file was reached. If RELATIVE was

specified, either the beginning of file or the end of file was reached,

depending on the value specified. If FIRST or LAST was specified, then
no
records satisfy the selection criteria. The name of the cursor is MERGE.

-- If this is an embedded SELECT statement, no rows satisfy the
selection



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.