× 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.



Good day everyone.

I need to update a table whose key is a customer number, say a NUMERIC(9,0).
I have to search with a cursor, for example like this:

EXEC SQL DECLARE CSR0001 CURSOR FOR
SELECT * FROM CUSTOMER_MASTER WHERE CUSTOMER_NUMBER IN (
123456789,
234567890,
345678901,....)

and assume that it is a literal very large list of customer numbers, say
over 20,000.

I need to do a simple update of a column for some status for each found
row. But I need also to report which row was NOT found in this search in
order to do some other task.

I suspect I should use a MERGE for this, but if I only use this cursor
approach, how does one know which rows are NOT found within the literal
list while the engine is searching?

Is there a kind of "exit" event to capture when the engine DOES NOT find a
matching row?

Thanks in advance.

JS

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.