IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

When will the execution happens for the sql statement


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
achusarath

New User


Joined: 21 Mar 2007
Posts: 26
Location: kerala

PostPosted: Thu Jul 12, 2007 9:21 am
Reply with quote

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
View user's profile Send private message
ratheesh_1983

New User


Joined: 11 Apr 2007
Posts: 19
Location: hyderabad

PostPosted: Thu Jul 12, 2007 2:08 pm
Reply with quote

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

icon_neutral.gif
REGARDS,
Ratheesh.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Fri Jul 13, 2007 8:00 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Capturing Job Execution Information All Other Mainframe Topics 3
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts process statement for SUPREC, CMPCOLM... TSO/ISPF 4
No new posts Parallel Sysplex - subprogram execution CICS 7
Search our Forums:

Back to Top