Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us