|
I may be off base here, but I think you need to add FOR UPDATE OF (field,field
...) to your Declare CURSOR statement.
Thanks,
Jeff Young
Sr. Programmer Analyst
Dynax Solutions, Inc.
A wholly owned subsidiary of enherent Corp.
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer
V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions
Implementer V5R3
----- Original Message ----
From: "KJFrey@xxxxxxxxxxxxxxx" <KJFrey@xxxxxxxxxxxxxxx>
To: rpg400-l@xxxxxxxxxxxx
Sent: Friday, February 9, 2007 10:10:14 AM
Subject: RPGLE SQL Update Cursor problem
I have a program that is using an SQL cursor to retrieve the data I need
to update.
C/EXEC SQL
C+ DECLARE C1 DYNAMIC SCROLL CURSOR FOR SELECT * FROM ITUNTP07 WHERE
C+ URCTRY = 1 and URPGM# = 230 and urclas = 'FF' and URSTAT not in
C+ ('APP','FTC-B','TERM')
C/END-EXEC
The program is retrieving the data and placing into a Host variable like
below
C/EXEC SQL
C+ FETCH NEXT FROM C1 INTO :Unitpolicy
C/END-EXEC
DUnitPolicy E DS EXTNAME(ITUNTP01)
The problem is when I am updating the fields in the data structure I want
to perform an update on the Cursor and I
would like to use WHERE CURRENT OF C1
C/EXEC SQL
C+ UPDATE ITUNTP07 SET URPSUS = :urpsus, URSUBS = :ursubs,
C+ URSSDT = :urssdt, URNFDT = :urnfdt, URCHDT = :urchdt, URCHTI =
C+ :urchti, URCHBY = :urchby WHERE CURRENT OF C1
C/END-EXEC
This does not work....I can't figure out what is wrong......here is the
error messages I am getting
Data mapping error on member ITUNTP07.
Data mapping error on member ITUNTP07.
Data mapping error on member ITUNTP07.
Null values not allowed in column or variable URCTRY.
Cause . . . . . : A data mapping error occurred on field in record
number
0, record format FORMAT0001, member number 1, in member ITUNTP07 file
ITUNTP07 in library ITSDEVFIL, because of error code 20. The error codes
and
their meanings follow:
20 -- A field that is not null capable could not be set to null.
Cause . . . . . : One of the following has occurred:
-- Column URCTRY is a target column in an UPDATE or INSERT statement
for
table ITUNTP07. Either a null value was specified to be
inserted or updated into this column or a value for the column was not
specified in an INSERT statement and the column does not allow null
values.
The null value was specified in the relative entry number 1 in the
VALUES
list, select list, or SET clause.
I am not updating URCTRY.........................I don't understand what
I am doing wrong.
any suggestions would be greatly appreciated.
Ken J Frey
IT Project Leader
Email: KJFrey@xxxxxxxxxxxxxxx
Office: 410-584-0391
Fax: 410-584-0391
Cell: 443-742-0642
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.