View previous topic :: View next topic
|
Author |
Message |
achusarath
New User
Joined: 21 Mar 2007 Posts: 26 Location: kerala
|
|
|
|
in a cursor program when will the execution happens for the sql statement,because if i am updating a row in a fetch step and then if it is displayed in the next line i will not get the updated value.After closing that cursor and again if it is opened and displayed i l get the updated value so when the updatio is happening? |
|
Back to top |
|
|
ratheesh_1983
New User
Joined: 11 Apr 2007 Posts: 19 Location: hyderabad
|
|
|
|
hello achusarath,
i think u r getting the column values from the table(for display purpose) by using a cursor, if so try declaring the cursor with the option "WITH UR". See the example below.
EXEC SQL
DECLARE READ_CUR CURSOR FOR
SELECT MY_ID-INFO
FROM MY_INFO-TB
WHERE
(MY_NAM = :WH-INP-NAM
AND MY_ID_NO = :WH-INP-ID)
ORDER BY MY_ID_NO
FOR FETCH ONLY
WITH UR
END-EXEC.
UR means "uncommitted read" ...please trythis in ur code and let me know..
REGARDS,
Ratheesh. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
Here is an excellent excellent article describing the history of cursors in DB2. It describes how sometimes you are working not directly with the database, but a materialized result set. So your cursor may or may not read directly from the table depending on how the optimizer decided to execute it.
www.db2mag.com/db_area/archives/2002/q3/programmers.shtml |
|
Back to top |
|
|
|