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
 
updating a db2 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
janmejay
Warnings : 1

New User


Joined: 22 Jun 2007
Posts: 81
Location: bangalore

PostPosted: Wed Nov 04, 2009 10:00 am    Post subject: updating a db2 table
Reply with quote

Hello

i have a db2 table which contains a phone_no field.
lets example
phone_no
___________

5223432
5234567
5244568
5367902

now i need to update the phone_no field.the starting no. 5 should be replaced by 6.
how to update at a single time , so that all phone nos starting with 5 should be replaced by 6.
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: Wed Nov 04, 2009 10:20 am    Post subject:
Reply with quote

Hello,

Is there some reason this is posted in the idms part of the forum?

You need to provide more info. . .

How is phone_no defined? If it the primary key? Is it a unique key?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Nov 04, 2009 10:28 am    Post subject:
Reply with quote

Code:

UPDATE yourtablename
SET phone_no = phone_no + 1000000       
WHERE phone_no BETWEEN 5000000 AND 5999999;


If it is not unique or primary key.. above will work for you.
Back to top
View user's profile Send private message
santosh100678

New User


Joined: 21 Sep 2009
Posts: 55
Location: Kolkatta

PostPosted: Wed Nov 04, 2009 12:21 pm    Post subject: upload db2 table using input as file throu jcl
Reply with quote

Hi

I need sample jcl throu which i upload db2 table using input as a file

1.Input file I have 2 generate thru cobol pgogram
2. first create input file thru cobol
3. submit jcl usiing above input file.
4. if some column in db2 table is varchar then during upload process from file to db2 table any change required .
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Nov 04, 2009 1:27 pm    Post subject:
Reply with quote

Sambhaji wrote:
Code:

UPDATE yourtablename
SET phone_no = phone_no + 1000000       
WHERE phone_no BETWEEN 5000000 AND 5999999;


If it is not unique or primary key.. above will work for you.

Why shouldn't it be primary key ?
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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

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