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


Looking at a SQL table table from a column path How do I modify values ​​like /dir/subdir/file.aaa => /dir/subdir/file.bbb example in my query the specific file / path is hard Modify file extension without code?

It looks perfect for:

 as  In the form of T (select '/dir/subdir/file.aaa' as the path of dual union '/dir/subdir.aaa/file.aaa' from dual) select regexp_replace (path, '[.] [^ .] * $ ',' .bbb ') path - ^^^^ ^^^^^^^^^ ^^^^ - Replace the last point as far as'% .aaa' - ^^^^ ^ - For the path ending with the "incorrect" extension, only the "right" extension can be from the extension.  

See some tests for


Comments