| From: | Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx> |
|---|---|
| To: | "sandrigo lezcano" <psql(at)msa(dot)com(dot)py> |
| Cc: | "Pgsql-ayuda" <Pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx> |
| Subject: | Re: [Pgsql-ayuda] ERROR: parser: parse error at or near "DECLARE" |
| Date: | 2003-06-03 22:59:22 |
| Message-ID: | m3r86abwdx.fsf@conexa.fciencias.unam.mx |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-es-ayuda |
"sandrigo lezcano" <psql(at)msa(dot)com(dot)py> writes:
Por favor NO ENVIEN CORREOS EN HTML a las listas. Texto plano es el
formato preferido para este tipo de foros.
> /* archivo: f_nombre_funcion.sql ---------*/
>
> CREATE FUNCTION f_nombre_funcion(integer)
> RETURNS varchar(40) AS '
> BEGIN
> DECLARE
> nombre varchar(40);
> SELECT descripcion AS nombre FROM funciones WHERE (funciones=$1)
> RETURN nombre;
> END;
> ' LANGUAGE 'SQL';
debería ser más bien algo como:
declare
...
begin
..
end;
y en el select tienes que darle algo como
SELECT descripcion INTO nombre FROM funciones WHERE (funciones=$1)
en vez de ``AS''. Ah! y no se te olvide el return nombre al final de
la función.
Saludos,
Manuel.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Manuel Sugawara | 2003-06-03 23:11:03 | Re: [Pgsql-ayuda] RV: function syb/pgsql |
| Previous Message | Manuel Sugawara | 2003-06-03 22:55:42 | Re: [Pgsql-ayuda] Como crear desencadenantes |