Does Postgresql have scalar and table-valued functions? Your syntax looks like the table-valued. Verify syntax in the manual.
>In PgAdmin III, If I execute;
>
>select data_ultimo_fecho('00001') as dia =>> return blank date
>
>and if I execute in PGAdmin III directely the line:
>
>SELECT max(data_fim_turno) as ultimo_fecho from turnos where produto='00001' =>> return correct value
>
>
>-- Function: data_ultimo_fecho(character)
>
>-- DROP FUNCTION data_ultimo_fecho(character);
>
>CREATE OR REPLACE FUNCTION data_ultimo_fecho(character)
> RETURNS date AS
>$BODY$SELECT max(data_fim_turno) as ultimo_fecho from turnos where produto='$1'$BODY$
> LANGUAGE sql VOLATILE
> COST 100;
>ALTER FUNCTION data_ultimo_fecho(character)
> OWNER TO aaaa_aaaaaa;
>
>Thanks in advance.
If it's not broken, fix it until it is.
My Blog