-- FUNCTION: public.fnc_retira_acentuacao_javascript(text) --DROP FUNCTION public.fnc_retira_acentuacao_javascript(text); CREATE OR REPLACE FUNCTION public.fnc_retira_acentuacao_javascript( var_dscr text) RETURNS character varying LANGUAGE 'plpgsql' COST 100 VOLATILE AS $BODY$ DECLARE var_ret character varying(200000); BEGIN SELECT REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE(TRIM(var_dscr), '\u00e1', 'á'), '\u00e0', 'ó'), '\u00f3', 'ó'), '\u00e2', 'â'), '\u00e3', 'ã'), '\u00e4', 'ä'), '\u00c1', 'Á'), 'u00c0', 'À'), '\u00c2', 'Â'), '\u00c3', 'Ã'), '\u00c4', 'Ä'), '\u00e9', 'é'), '\u00e8', 'è'), '\u00ea', 'ê'), '\u00c9', 'É'), '\u00c8', 'È'), '\u00ca', 'Ê'), '\u00cb', 'Ë'), '\u00ed', 'í'), '\u00ec', 'ì'), 'u00ee', 'î'), '\u00ef', 'ï'), '\u00cd', 'Í'), '\u00cc', 'Ì'), '\u00ce', 'Î'), '\u00cf', 'Ï'), '\u00f3', 'ó'), '\u00f2', 'ò'), '\u00f4', 'ô'), '\u00f5', 'õ'), '\u00f6', 'ö'), '\u00d3', 'Ó'), '\u00d2', 'Ò'), '\u00d4', 'Ô'), '\u00d5', 'Õ'), '\u00d6', 'Ö'), '\u00fa', 'ú'), '\u00f9', 'ù'), '\u00fb', 'û'), '\u00fc', 'ü'), '\u00da', 'Ú'), '\u00d9', 'Ù'), '\u00db', 'Û'), '\u00e7', 'ç'), '\u00c7', 'Ç'), '\u00f1', 'ñ'), '\u00d1', 'Ñ'), '\u0026', '&'), '\u0027', ''), '\u00b3', '³'), '\u00b5', 'µ') INTO var_ret; RETURN var_ret; END; $BODY$; ALTER FUNCTION public.fnc_retira_acentuacao_javascript(text) OWNER TO postgres;