Skip to content

Instantly share code, notes, and snippets.

@ddeaguiar
Created May 1, 2009 21:28
Show Gist options
  • Save ddeaguiar/105271 to your computer and use it in GitHub Desktop.
Save ddeaguiar/105271 to your computer and use it in GitHub Desktop.
select
CASE
WHEN (REGEXP_SUBSTR(category, '(a[[:alnum:]]|sa)', 1, 1, 'i') is not null) THEN 'SUITE'
WHEN (REGEXP_SUBSTR(category, '(d[[:digit:]]|sd)', 1, 1, 'i') is not null) THEN 'DELUXE_BALCONY'
WHEN (REGEXP_SUBSTR(category, '(b[[:alnum:]]|sb)', 1, 1, 'i') is not null) THEN 'BALCONY'
WHEN (REGEXP_SUBSTR(category, '(c|d|e|f|g|h)[[:alnum:]]?', 1, 1, 'i') is not null) THEN 'OCEANVIEW'
ELSE 'INTERIOR'
END AS META
from foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment