pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PROBLEM WITH FUNCTION
2+ messages / 2 participants
[nested] [flat]

* PROBLEM WITH FUNCTION
@ 2004-05-02 19:01 Mario Alberto Soto Cordones <mario_soto@venezolanadeavaluos.com>
  2004-05-03 03:18 ` Re: PROBLEM WITH FUNCTION Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Mario Alberto Soto Cordones @ 2004-05-02 19:01 UTC (permalink / raw)
  To: pgsql-admin

HI list,
i have a next function

CREATE OR REPLACE FUNCTION "public"."contador_distrito_activos" (numeric,
numeric, numeric) RETURNS SETOF "public"."ty_activo" AS'
declare
  con bigint;
  act bigint;
  emp alias for $1;
  sed alias for $2;
  zon alias for $3;
begin
  con := contador_distrito(1,2,5);
  if (con > 0) then
     act := ( select count(*) from activos where
             activos.co_empresa = 1 and
             activos.co_filial = 2 and
             activos.co_zona = 5);
     if act isnull then
        act := 0;
     end if;
  else
     con :=0;
     act :=0;
  end if;
return con , act;

end;
'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

But this function only return the value of con ;

any idea

Thank





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PROBLEM WITH FUNCTION
  2004-05-02 19:01 PROBLEM WITH FUNCTION Mario Alberto Soto Cordones <mario_soto@venezolanadeavaluos.com>
@ 2004-05-03 03:18 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2004-05-03 03:18 UTC (permalink / raw)
  To: Mario Alberto Soto Cordones <mario_soto@venezolanadeavaluos.com>; +Cc: pgsql-admin

"Mario Alberto Soto Cordones" <mario_soto@venezolanadeavaluos.com> writes:
> CREATE OR REPLACE FUNCTION "public"."contador_distrito_activos" (numeric,
> numeric, numeric) RETURNS SETOF "public"."ty_activo" AS'
> declare
>   con bigint;
>   act bigint;
> ...
> return con , act;

plpgsql has no shorthand for constructing a rowtype result, as you seem
to be expecting here.  Declare a variable of type ty_activo, fill it in,
and return it.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-05-03 03:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-02 19:01 PROBLEM WITH FUNCTION Mario Alberto Soto Cordones <mario_soto@venezolanadeavaluos.com>
2004-05-03 03:18 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox