oracle - Complex sub-string replace query SQL -


i have following table containing path info:

i need replace directory_name value in path field new_dir_name value recursively.

sample table:

path                                              |directory_name                   |new_dir_name
...............................................................................................................
\folder1\folder2\2a                          | folder2\2a                                  | folder2/2a
\folder1\folder2\2a\folder3              | folder3                                       | folder3
\folder1\folder2\2a\folder4              | folder4                                       | folder4
\folder1\folder2\2a\folder4\2a\2b    | 2a\2b                                         | 2a/2b
...............................................................................................................
result this: * changes in bold

new_path
...............................................................................................................
\folder1\ folder2/2a
\folder1\ folder2/2a\folder3
\folder1\ folder2/2a\folder4
\folder1\ folder2/2a\folder4\ 2a/2b
...............................................................................................................

database oracle.

using select replace(path, directory_name, new_dir_name) function yield folowing (not solution):

\folder1\ folder2/2a
\folder1\folder2\2a\ folder3
\folder1\folder2\2a\ folder4
\folder1\folder2\2a\folder4\ 2a/2b

please tell me field name isn't string. anyways, here's code need, based on supplied field names.

select replace(string,reference,replace_with) 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -