Reputation: 263
I have a column in a datawarehouse task which needs replacing these characters:
"ABCDEFGHIJKLMNOPQRSTUVWXYZ\abcdefghijklmnopqrstuvwxyz"
with nothing.
For example I have this form of data "88k77.22
" and it should be "8877.22
"
Does anyone know any particular function which can do this, or any workaround.
Thanks in advance
Upvotes: 2
Views: 677
Reputation: 51871
Use a regular expression
REGEXP_REPLACE(column, '[A-Za-z]*', '')
Is '\' supposed to be included as well? Then use
REGEXP_REPLACE(column, '[A-Za-z\]*', '')
Upvotes: 6
Reputation: 1269493
Oracle supports translate()
, which does exactly what you want:
translate(col, ' ABCDEFGHIJKLMNOPQRSTUVWXYZ\abcdefghijklmnopqrstuvwxyz', ' ')
Upvotes: 3