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
 

 

Updating table through arithmetic function

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
madlui56
Currently Banned

New User


Joined: 08 Aug 2006
Posts: 61
Location: Philippines

PostPosted: Thu Aug 30, 2007 3:07 pm    Post subject: Updating table through arithmetic function
Reply with quote

How is this done?Is this possible?
I just want to update a specific field in the table wherein I will just have to subtract an amount to that particular field..How is this done?

Such us;

Update table
set table field = (field - 400)

Thanks
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 30, 2007 3:12 pm    Post subject:
Reply with quote

yep, except for the syntax you have it right. 'Manuals' hyperlink at the very top of this page, then look for an SQL manual to find out the exact syntax for an update. You should include a WHERE clause to insure that you only UPDATE rows that you want and not all rows in the table.

The parenthesis in the SET statement are not required.
Back to top
View user's profile Send private message
madlui56
Currently Banned

New User


Joined: 08 Aug 2006
Posts: 61
Location: Philippines

PostPosted: Thu Aug 30, 2007 3:17 pm    Post subject: Thanks
Reply with quote

I will find the document you suggested
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Aug 30, 2007 8:38 pm    Post subject:
Reply with quote

Hello,

Is a negative value valid for "field"?

If not, you would test to make sure that the -400 did not result in a negative value.
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 Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 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


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