replace function in oracle

Hello Experts:

I two columns in ORA table with NAS path i.e.

\\folder1\folder2\folder3\some file name1.doc
\\folder1\folder2\folder3\some file name2.doc
\\folder1\folder2\folder3\some file name3.doc
\\folder1\folder2\folder3\some file name4.doc

Open in new window


I would like to replace it with new NAS path \\folder4\folder5\folder6\

output like this

 \\folder4\folder5\folder6\some file name1.doc
 \\folder4\folder5\folder6\some file name2.doc
 \\folder4\folder5\folder6\some file name3.doc
 \\folder4\folder5\folder6\some file name4.doc

Open in new window


Can somebody please assist with this update query?

Regards,
CS
LVL 5
CalmSoulAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Walter RitzelSenior Software EngineerCommented:
update table
set column = replace(column,'\\folder1\folder2\folder3\','\\folder4\folder5\folder6\')
where key = < value>;

Open in new window

0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
You can also use something like
update table
set col = replace(col,'\\folder1\folder2\folder3\','\\folder4\folder5\folder6\')
where col like = '\\folder1\folder2\folder3\%';

Open in new window

to replace all occurrences.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awking00Information Technology SpecialistCommented:
You could also accomplish the above without the replace function -
update yourtable
set path =  '\\folder4\folder5\folder6'||substr(path,instr(path,'\',-1))
where path like '\\folder1\folder2\folder3\%';

However, since you mention two columns, are you trying to replace the path in one column with the path from another column? If so, could you provide some sample data for both columns and your expected output?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.