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
 

 

DB2 table update

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
bashir ahmad

New User


Joined: 11 May 2013
Posts: 6
Location: canada

PostPosted: Fri May 24, 2013 3:34 am    Post subject: DB2 table update
Reply with quote

I select db2 table row based on input file to check the row existance then updated table successfully.
I displayed columns before update which shows correct but when I display columns after update, it doesn't show the values whereas the selected row is updated!!!
Q. Should I select the table again to display column values after
update??? pl reply thanks.
Bashir
Back to top
View user's profile Send private message

sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Fri May 24, 2013 11:38 am    Post subject:
Reply with quote

Hi Bashir,

Welcome to IBMMAINFRAMES.com

Yes, you need execute select statement again to see the updated values, i am not sure how you are displaying the columns after-update now.

If you don't want to execute second SELECT statement, you can try this FINAL TABLE technique.

Thanks,
Sushanth
Back to top
View user's profile Send private message
bashir ahmad

New User


Joined: 11 May 2013
Posts: 6
Location: canada

PostPosted: Mon May 27, 2013 11:36 pm    Post subject: DB2 Table update
Reply with quote

1. I use select the updated table again to display the the result "After updated row", but I never used the FINAL TABLE technique to avoid second select after update. Can you pl send a brief example, thanks.

2. I have other following issue also:

a) I use left outer join for table A and B while declare cursor with hold (in
procedure div not in working-storage section). Table a has foreign key
ie P-key to B.
but Table B has compound P-key (i.e part of B's P-key is F-key to A).
b) Table B has some matching rows to table A.
c) In case keys are matched I insert some more rows to B successfully as
per requirement. in case of keys are unmatched Row are also inserted
successfully to B.
d) In case of matched keys: after successful row insertion prog fetch the
inserted row again. this confused me, the prog should fetch the next
row from temporary table which is the resultant of left join.
Note: The interesting thing is: suppose B has row like AFGC ..... and when the row is inserted with key ABCD then prog fetch ABCD again, but it doesn't happen in vice versa case.
Pl review and suggest the possible solution, thanks.
Bashir.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Tue May 28, 2013 10:43 am    Post subject:
Reply with quote

Bashir,

For FINAL TABLE example, Click Here.

I dont understand your other question properly, you may need to show an example of your query with sample data of table with desired result or your code, for anyone to answer.

Thanks,
Sushanth
Back to top
View user's profile Send private message
bashir ahmad

New User


Joined: 11 May 2013
Posts: 6
Location: canada

PostPosted: Wed Jun 05, 2013 9:51 pm    Post subject: Reply to: DB2 table update
Reply with quote

HI

What will happen in case of "DUPLICATE ROW" while using "FINAL TABLE" Technique?
Should I use EXISTANCE CHECK for the for the row to be inserted or updated before using "FINAL TABLE" Technique in which I select and update/insert at one place and can check the value before and after update. Thanks.
Best Regards
Bashir.
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 IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


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