× 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 a bit confused. Doesn't your select with LEFT JOIN qualifier return all
of the "office"s from NHISXX? Being that's the file you're subsequently
updating, wouldn't that mean you're updating each and every row's "fill01"
value to 'X'?
I'm probably missing something, but why couldn't a single statement such as
this work:

update NHISXX h set fill01 = 'X'
WHERE h.rectyp = 'PA' and h.userid <> ' ' and h.office = :pOffice and EXISTS

(SELECT 1
FROM NCUSTT c
WHERE c.office = h.office)

Elvis

Celebrating 10-Years of SQL Performance Excellence
http://centerfieldtechnology.com/training.asp

-----Original Message-----
Subject: Updating a record using embedded SQL

This is my first attempt at updating a record using SQL. I believe my
problem lies in the DECLARE stmt because of the JOIN:

declare c1 cursor for
SELECT h.office, chart, crtdat, undata, userid, offno
FROM NHISXX as h
LEFT JOIN NCUSTT as c ON h.office = c.office
WHERE h.rectyp = 'PA' and h.userid <> ' ' and h.office =
:pOffice;

I want to update a field in the NHISXX file but am not able to add the FOR
UPDATE OF clause to the above. I am using a cursor because of other
processing in the pgm.

My update statement is as follows:

update NHISXX set fill01 = 'X'
where current of c1;

Any suggestions on how to best handle this situation? Thanks.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.