hai all, i'm trying create function like this

CREATE OR REPLACE FUNCTION penjualan(idcb integer)
 RETURNS SETOF penjualan AS
$BODY$
BEGIN

IF ($1 IS NULL) THEN
 return query SELECT * FROM PENJUALAN;
ELSE
 return query SELECT * FROM PENJUALAN WHERE IDCABANG=$1;
END IF;

END;
$BODY$
 LANGUAGE 'plpgsql' VOLATILE
 COST 100
 ROWS 1000;

but this function is not work with this error : ERROR: structure of query does not match function result type
CONTEXT:  PL/pgSQL function "penjualan" line 6 at RETURN QUERY

on the time i try with other table and working well

thanks for your help



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to