View previous topic :: View next topic
|
Author |
Message |
vijikesavan
Active User
Joined: 04 Oct 2006 Posts: 118 Location: NJ, USA
|
|
|
|
Hi,
I have a program which has a Cursor with 2 columns declared, but only one field is fetched during FETCH cursor.
the code is running fine in produciton.
The Declare stmnt:
Code: |
DECLARE ACCOUNT-CURSOR CURSOR FOR
SELECT
AC_XTNL_NO,
AC_XTNLNO_END_CDT
FROM |
The fetch stmnt:
Code: |
EXEC SQL
FETCH ACCOUNT-CURSOR
INTO :CRF-AC-XTNL-NO
END-EXEC. |
Why this is not giving any error?. Is it because the last field being missed?
My understanding so far - the number of columns declared in the cursor should be fetched.
Can anyone clarify me please.
Thanks,
Viji |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
vijikesavan wrote: |
The Declare stmnt:
Code: |
DECLARE ACCOUNT-CURSOR CURSOR FOR
SELECT
AC_XTNL_NO,
AC_XTNLNO_END_CDT
FROM |
The fetch stmnt:
Code: |
EXEC SQL
FETCH ACCOUNT-CURSOR
INTO :CRF-AC-XTNL-NO
END-EXEC. |
Why this is not giving any error?. Is it because the last field being missed?
My understanding so far - the number of columns declared in the cursor should be fetched. |
I'd be guessing that DB2 is being nice to you since you only asked for the one column. I'd think you would get both if the fetch had two host variables to put both in.....
Just guessing.... |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
HI
this wont give any error but the SQLWARN3 field of SQLCA will be set to W ..tht is a warning .... |
|
Back to top |
|
|
|