[Pgsql-ayuda] Problema con funciones

From: Adrian Galindo <agalindo(at)salud(dot)gob(dot)mx>
To: Pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx
Subject: [Pgsql-ayuda] Problema con funciones
Date: 2003-06-18 18:47:18
Message-ID: 3EF0B3B6.3010205@salud.gob.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

*This message was transferred with a trial version of CommuniGate(tm) Pro*
Estoy intentando crear una funcion quitaacentos. Intenté hacerlo a la Oracle, donde le das el nombre de la variable con cualqueir nombre y me marcaba el siguiente error:

bd=> CREATE FUNCTION quitaacentos (cadena) RETURNS varchar AS .... bla bla ....
ERROR: Type "cadena" does not exist

Finalmente le busqué y me encontré que con cstring puedes hacer esto, pero al manda llamar la función, me dice esto:

ssa=> CREATE FUNCTION quitaacentos (cstring) RETURNS varchar AS
ssa-> 'select REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
ssa'> REPLACE(cstring, \'á\', \'a\'), \'Á\', \'A\'),\'é\',\'e\'), \'É\',\'E\'), \'Í\', \'I\'),\'í\',\'i\'),
ssa'> \'Ó\', \'O\'),\'ó\',\'o\'),\'Ú\', \'U\'),\'ú\',\'u\'),\'ñ\',\'n\')'
ssa-> LANGUAGE 'plpgsql';
CREATE FUNCTION
ssa=> select quitaacentos('Álgó cón áceñtós');
WARNING: plpgsql: ERROR during compile of quitaacentos near line 0
ERROR: plpgsql functions cannot take type cstring

¿Por dónde puedo darle para solucionar esto?
Cualquier ayuda será bien recibida.

Gracias de antemano.
Saludos.
Adrián.

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Gunnar Wolf 2003-06-18 18:54:09 Re: [Pgsql-ayuda] Función validadora tal vez demasiado ambiciosa
Previous Message Manuel Sugawara 2003-06-18 17:24:44 Re: [Pgsql-ayuda] C y Postgres