Search Postgresql Archives

[ask] Return Query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux