Home > Database, Oracle > Find and replace in clobs

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.

Advertisements
Categories: Database, Oracle
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: