Last active
November 19, 2018 19:01
-
-
Save samirfor/ef7c45401ddd53baa8df783bc0b4925b to your computer and use it in GitHub Desktop.
Uma funçãozinha para remover acentos de strings no PostgreSQL... Útil.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Uma funçãozinha para remover acentos de strings no PostgreSQL... Útil. | |
-- Créditos: papo sql | |
CREATE OR REPLACE FUNCTION retira_acentuacao(p_texto text) RETURNS text AS $BODY$ | |
SELECT TRANSLATE($1, | |
'áàâãäåÁÀÂÃÄÅéèêẽëÉÈÊẼËíìîïÍÌÎÏóòôõöÓÒÔÕÖúùûüÚÙÛŨÜçÇñÑýÝ', | |
'aaaaaaAAAAAAeeeeeEEEEEiiiiIIIIoooooOOOOOuuuuUUUUUcCnNyY' | |
); | |
$BODY$ LANGUAGE SQL VOLATILE COST 100; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment