oracle - SQL query to change file extension in a record containing a file-path? -



oracle - SQL query to change file extension in a record containing a file-path? -

given sql table table column path, how can modify values /dir/subdir/file.aaa => /dir/subdir/file.bbb e.g. modify file-extension without having hard-code specific file/path query?

seems perfect fit regexp_replace :

with t (select '/dir/subdir/file.aaa' path dual union select '/dir/subdir.aaa/file.aaa' dual) select regexp_replace(path, '[.][^.]*$', '.bbb') path -- ^^^^ ^^^^^^^^^ ^^^^ -- replace lastly dot-whatever "right" extension t path '%.aaa' -- ^^^^^ -- path ending "wrong" extension

see http://sqlfiddle.com/#!4/d41d8/37017 tests

sql oracle

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -