-
Hi
In a table, have a column with contents of uniform length 15. This varchar column has to be updated selectively...i.e., 2 characters in the middle have to be replaced with 3 characters. Any idea how to accomplish this ??
eg.,
10HN93A1: 1
10HN93A1: 2
10HN93A1: 3
10HN93A1: 4
10HN93A1: 5
10HN93A1: 6
10HN93A1: 7
In the above, have to replace A1 with A01 to get the following...
10HN93A01: 1
10HN93A01: 2
10HN93A01: 3
10HN93A01: 4
10HN93A01: 5
10HN93A01: 6
10HN93A01: 7
So also, the values are A1, B1, C1, C2, C30, etc...
Thanks.
-
I think you will have to do some string splicing with the SUBSTR function. Or you may be able to use the REPLACE function if you only have one match per row.
regards
Jim
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
-
Assuming all records have same length as you said:
UPDATE tbl
SET col = SUBSTR(col,1,7)||'0'||SUBSTR(col, 8,4)
WHERE your_condition;
Of course it can be done in many ways.
Sanjay
-
Thanks. That solved it !!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|