(Oracle) Convert us7ascii in Snowflake?

316 views Asked by At

I'm looking for an alternative for the oracle convert() function in Snowflake. More specifically speaking I want to replace special characters in a string value (e.g. é, ä, ö) with the best matching letters.

In Oracle I can do something like this: convert('émíliõ', 'us7ascii') which would return 'emilio'.

I know I can write loads of replace() statements to do this but I was wondering if there is a better way to do this?

2

There are 2 answers

3
NickW On

Try the TRANSLATE function Translate

2
codie-fz On

Solved it like this:

translate('émíliõ',

'ÄäÀàÁáÂâÃãÅåǍǎĄąĂăÆæĀā
ÇçĆćĈĉČč
ĎđĐďð
ÈèÉéÊêËëĚěĘęĖėĒē
ĜĝĢģĞğ
Ĥĥ
ÌìÍíÎîÏïıĪīĮį
Ĵĵ
Ķķ
ĹĺĻļŁłĽľĿŀ
ÑñŃńŇňŅņ
ÖöÒòÓóÔôÕõŐőØøŒœ
ŔŕŘř
ẞߌśŜŝŞşŠšȘș
ŤťŢţÞþȚț
ÜüÙùÚúÛûŰűŨũŲųŮůŪū
Ŵŵ
ÝýŸÿŶŷ
ŹźŽžŻż',

'AaAaAaAaAaAaAaAaAaAaAa
CcCcCcCc
DdDdo
EeEeEeEeEeEeEeEe
GgGgGg
Hh
IiIiIiIilIiIi
JJ
Kk
LlLlLlLlLl
NnNnNnNn
OoOoOoOoOoOoOooo
RrRr
ssSsSsSsSsSs
TtTtÞbTt
UuUuUuUuUuUuUuUuUu
Ww
YyYyYy
ZzZzZz')```

Thanks @NickW !