Calling a function from another - Mailing list pgsql-general

From Együd Csaba
Subject Calling a function from another
Date
Msg-id 002d01c2d4c9$c0dd5180$200a0a0a@notebook
Whole thread Raw
Responses Re: Calling a function from another  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
Hi,
Could you please give me some help? I would like to call a function from
another. There are three functions, (say fa(int,int), fb(int,int) and
fc(int,int)). What's the problem with this:

create function "fc" (int, int) returns int as'
declare
  x alias for $1;
  y alias for $2;
begin
  perform fa (x,y);
  perform fb (x,y);
end;
' language 'plpgsql'

Or this:

create function "fc" (int, int) returns int as'
declare
  x alias for $1;
  y alias for $2;
begin
  execute ''select fa('' || x || '','' || y || '')'';
  execute ''select fb('' || x || '','' || y || '')'';
end;
' language 'plpgsql'

Or this:

create function "fc" (int, int) returns int as'
declare
  x alias for $1;
  y alias for $2;
begin
  execute ''select fa('' || quote_literal(x) || '','' || quote_literal(y) ||
'')'';
  execute ''select fb('' || quote_literal(x) || '','' || quote_literal(y) ||
'')'';
end;
' language 'plpgsql'


I tried all of them above. When I called them one after another from the
console, they worked proprely. But calling the composite function it did
nothing. No errors, just does not do anything.
How should I call these functions.

Thank you in advance,
Csaba




pgsql-general by date:

Previous
From: "Shridhar Daithankar"
Date:
Subject: Re: Performance a lot
Next
From: Tony Grant
Date:
Subject: Re: Just installed using Fink on OS X. Fails all over