[Pgsql-ayuda] ERROR: parser: parse error at or near "DECLARE"

sandrigo lezcano psql@msa.com.py
Tue, 3 Jun 2003 18:31:23 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0015_01C329FE.55EE04C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

intento crear un funcion que me devuelva la=20
descripcion de un elemento una tabla=20
tipo de funciones(tipo: codigo,descri)


/* archivo: f_nombre_funcion.sql  ---------*/
CREATE FUNCTION f_nombre_funcion(integer)=20
   RETURNS varchar(40) AS '
     BEGIN
       DECLARE
          nombre varchar(40);
       SELECT descripcion AS nombre FROM funciones WHERE =
(funciones=3D$1)=20
       RETURN nombre;=20
     END;
' LANGUAGE 'SQL';

rrhh=3D#\i /mnt/tempdown/functions/f_nombre_funcion.sql
psql:/mnt/tempdown/functions/f_nombre_funcion.sql:10=20
ERROR: parser: parse error at or near "DECLARE"

y NO puedo! encontrar por que podria ser en los
link de docs.

..alguna ayuda???? =20

GRACIAS



____________________________________________________
Sandrigo Lezcano Jara             Asunci=F3n, Paraguay
usando______: Ret Hat 7.2 (Enigma) - Kernel 2.4.7-10=20
              PostgreSQL 7.1.3 - psqlODBC 7.02.00.01
migrando____: Sybase 6.5   al   PostgreSQL=20
front end___: PowerBuilder 6.5        =20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DICQ:143590717=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
____________________________________________________

------=_NextPart_000_0015_01C329FE.55EE04C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>intento crear un funcion que me devuelva la </DIV>
<DIV>descripcion de un elemento una tabla </DIV>
<DIV>tipo de funciones(tipo: codigo,descri)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>/* archivo: f_nombre_funcion.sql&nbsp; ---------*/</DIV>
<DIV>CREATE FUNCTION f_nombre_funcion(integer) </DIV>
<DIV>&nbsp;&nbsp; RETURNS varchar(40) AS '</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; BEGIN</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DECLARE</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nombre=20
varchar(40);</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SELECT descripcion AS =
nombre FROM=20
funciones WHERE (funciones=3D$1) </DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RETURN nombre; </DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; END;</DIV>
<DIV>' LANGUAGE 'SQL';</DIV>
<DIV>&nbsp;</DIV>
<DIV>rrhh=3D#\i /mnt/tempdown/functions/f_nombre_funcion.sql</DIV>
<DIV>psql:/mnt/tempdown/functions/f_nombre_funcion.sql:10 </DIV>
<DIV>ERROR: parser: parse error at or near "DECLARE"</DIV>
<DIV>&nbsp;</DIV>
<DIV>y NO puedo! encontrar por que podria ser en los</DIV>
<DIV>link de docs.</DIV>
<DIV>&nbsp;</DIV>
<DIV>..alguna ayuda????&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV>GRACIAS</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>____________________________________________________<BR>Sandrigo =
Lezcano=20
Jara&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;=20
Asunci=F3n, Paraguay<BR>usando______: Ret Hat 7.2 (Enigma) - Kernel =
2.4.7-10=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
PostgreSQL 7.1.3 - psqlODBC 7.02.00.01<BR>migrando____: Sybase =
6.5&nbsp;&nbsp;=20
al&nbsp;&nbsp; PostgreSQL <BR>front end___: PowerBuilder=20
6.5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
<BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DICQ:143590717=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>_________=
___________________________________________</DIV></BODY></HTML>

------=_NextPart_000_0015_01C329FE.55EE04C0--