Примерно так:
with t as (
select 'STRING"' as s from dual union all
select '"STRING' from dual union all
select 'STRI"NG' from dual union all
select 'STRING""' from dual union all
select '"STRING"' from dual union all
select 'STRING' from dual union all
select '"STR"ING"' from dual union all
select '"' from dual union all
select '""' from dual union all
select '"""' from dual
)
select
s,
regexp_replace(s,'^([^"]*)"([^"]*)$', '\1""\2') new_s
from t
Вывод:
+-----------+-----------+
| S | NEW_S |
+-----------+-----------+
| STRING" | STRING"" |
| "STRING | ""STRING |
| STRI"NG | STRI""NG |
| STRING"" | STRING"" |
| "STRING" | "STRING" |
| STRING | STRING |
| "STR"ING" | "STR"ING" |
| " | "" |
| "" | "" |
| """ | """ |
+-----------+-----------+
Объяснение:
^ # asserts position at start of a line
( # 1st capturing group
[^"]* # matches characters that are not the character ", zero or more times
)
" # matches the character " literally
( # 2nd capturing group
[^"]*
)
$ # asserts position at the end of a line
Проверьте это онлайн с rextester .