Archive

Posts Tagged ‘SQL’

Find and replace in clobs

It can often be a bit tricky to work with clobs. The normal replace string function doesn’t support them, so Today I spent some time writing my own version. Shortly afterwards I happened upon another built-in function that does the job: regexp_replace. For example, regexp_replace(a_clob, '[' || chr(10) || chr(13) || ']', '') removes all newlines (carriage returns and line feeds).

Only the first argument (the text) has full support for clobs, the expression and substitution string are both limited to 32k. I can’t really see where that would matter, though.

Categories: Database, Oracle