Skip to content

Instantly share code, notes, and snippets.

@pcdinh
Created August 14, 2009 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcdinh/167717 to your computer and use it in GitHub Desktop.
Save pcdinh/167717 to your computer and use it in GitHub Desktop.
UPDATE documents
SET doc_code = REGEXP_REPLACE(doc_code, '.Q[[:digit:]]{1}.',
(CASE
WHEN REGEXP_LIKE(doc_code, '.(E|L).(10|11|12){1}.') THEN '.4.'
WHEN REGEXP_LIKE(doc_code, '.(E|L).0(7|8|9){1}.') THEN '.3.'
WHEN REGEXP_LIKE(doc_code, '.(E|L).0(4|5|6){1}.') THEN '.2.'
WHEN REGEXP_LIKE(doc_code, '.(E|L).0(1|2|3){1}.') THEN '.1.'
END ))
WHERE REGEXP_LIKE(doc_code, '.Q[[:digit:]]{1}.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment