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
 

 

REPLACE/UPDATE a partial string in a column (VARCHAR type)

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

New User


Joined: 21 Feb 2006
Posts: 9
Location: india

PostPosted: Thu Aug 02, 2007 1:42 pm    Post subject: REPLACE/UPDATE a partial string in a column (VARCHAR type)
Reply with quote

Hi,

I need to REPLACE/UPDATE a partial string 'PQ' to 'QC' in a column (VARCHAR type) using SQL query. Please find following example for better understanding.

Example:
COLUMN VALUE UPADATE STRING
1000ABPQ 1000ABQC
XCPQJK XCQCJK
PQ QC

Please tell me the best way to do this...

Thanks & Regards,
Mallik
Back to top
View user's profile Send private message

mallikannasagaram

New User


Joined: 21 Feb 2006
Posts: 9
Location: india

PostPosted: Thu Aug 02, 2007 1:45 pm    Post subject: Re: SQL UPDATE QUERY
Reply with quote

Example:
COLUMN VALUE
1000ABPQ
XCPQJK
PQ

UPADATE STRING
1000ABQC
XCQCJK
QC
Back to top
View user's profile Send private message
Raphael Bacay

New User


Joined: 04 May 2007
Posts: 58
Location: Manila, Philippines

PostPosted: Fri Aug 03, 2007 9:30 am    Post subject:
Reply with quote

Hi!

I think you need to use COBOL with this.
You can SELECT all rows containing 'PQ' with a
COL = *PQ*.

Then you can Do a fetch of all rows containing columns
with PQ. Then you can do an INSPECT REPLACING ALL 'PQ' BY 'QC'.
Then you can UPDATE the replaced value into the table as you fetch
each row.

All in all you SELECT, FETCH, INSPECT, UPDATE each row that contains
the string 'PQ' to replace it with 'QC'.


Regards.
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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
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


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