Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

When will the execution happens for the sql statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: When will the execution happens for the sql statement
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    Post subject:
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    Post subject:
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.

http://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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
This topic is locked: you cannot edit posts or make replies. Updating value of key using rewrite s... ParminderKumar COBOL Programming 4 Thu Aug 04, 2016 12:46 am
This topic is locked: you cannot edit posts or make replies. JCL MULTIPLE STEP EXECUTION QUERY Susanta JCL & VSAM 18 Sat Jul 30, 2016 1:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us