Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update query 1

Status
Not open for further replies.

Zargo

Programmer
Mar 21, 2005
109
Hi,

I have a table like this:

tableA
ColumnA
NK232341234B01
111234556
JHJLKJKJLB01
SDFKSDJFLKASB01

How can i update these records to change the substr(columnA,-3,1) from B to 8 if this position has a B?

When the value is like NK232341234B01 it must be NK232341234801

Hope somebody can help me out of this problem...




 
Code:
update table 
set string = (case when substr(string,-3,1) = 'B' then substr(string, 1, length(string)-3)||'8'||
substr(string,-2,2) else string end)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top