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