IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Updating data in VARCHAR field


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sunny_io

New User


Joined: 11 Jul 2007
Posts: 68
Location: noida

PostPosted: Fri Dec 19, 2014 8:49 pm
Reply with quote

Hello Guru's

UPDATE table-name
SET SUBSTR(VARFIELD,10,10) = 'ABCDEFGHIJ'
WHERE SUBSTR(VARFIELD,10,10) = 'XXXXXXXXXX'

Is giving me syntax error on the SQl -104 .. ILLEGAL SYMBOL '('

My requirement is to identify and update all rows where from byte 10 to 10 in the VARCHAR field, the data is a certain predefined value.

Wondering if I can update part f the data in a VARCHAR field in SPUFI as opposed to writing an Application program for it. Any other suggestions are welcome.

The length of data would not change

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

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Sat Dec 20, 2014 6:51 am
Reply with quote

Hi ,

If I have understood your query (english) correctly may be you are looking for something like this

UPDATE table-name
SET VARFIELD = CONCAT( SUBSTR(VARFIELD,1,9),'ABCDEFGHIJ')
WHERE SUBSTR(VARFIELD,10,10) = 'XXXXXXXXXX' ;

PS: Try it at your own risk :-)

Regards,
Manoj Jadwani
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Tue Dec 23, 2014 2:21 am
Reply with quote

Manoj, Yes, that should work.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top