IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

DB2 table update


 
IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 1018
Location: India

PostPosted: Fri May 24, 2013 11:38 am
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
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: 1018
Location: India

PostPosted: Tue May 28, 2013 10:43 am
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
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 All times are GMT + 6 Hours
Forum Index -> DB2
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Group comparison/update between two f... DFSORT/ICETOOL 10
No new posts Need to read duplicate rows from tabl... DB2 3
No new posts Hex Table COBOL Programming 2
No new posts Catalog table SYSSTATSFEEDBACK DB2 2
No new posts Global temporary table DB2 1

Back to Top