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



"better" in what way?

Db2 for i supports SQL statements of up to 2MB in size..

Either way the OP would end up with a list of static values passed to the
Db2, either in the single statement or in the insert into a temp table.

Inserting has overhead that the table value constructor method does not.

Charles

On Tue, Jul 14, 2020 at 3:07 PM Jose Perez <joseenocperez.jp@xxxxxxxxx>
wrote:

Hey Charles did you have a chance to read this
"and assume that it is a literal very large list of customer numbers, say
over 20,000" . Considering this your values will be toooooooooo long is
better to build
a table with all customers to search.

On Tue, Jul 14, 2020 at 4:56 PM Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:

with selected_custs (customer_number) as
Values (123456789) , (234567890), (345678901)
)
select *
from selected_custs S
left outer join customer_master M
on M.customer_number = s.customer_number;

Note you're get two customer_number columns back, the second will be NULL
if the customer isn't found in customer_master

Charles




On Tue, Jul 14, 2020 at 1:48 PM Javier Sanchez <
javiersanchezbarquero@xxxxxxxxx> wrote:

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
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.