I have a function func1()
which returns integer.
I want to write another function func2(mode integer)
which can return func1()
reults or do some more stuff. The return value of func1()
is of type INTEGER
.
something like this:
CREATE OR REPLACE FUNCTION func2(mode integer)
RETURNS integer AS
$$
begin
if mode=1 then
return func1(); -- NOT plpgsql syntax
end if;
more stuff .....
return 2;
end
$$
LANGUAGE plpgsql VOLATILE
my question is how to do return func1();
?
I know I can do :
select func1() into temp;
return temp;
but I was wondring if there is a more elegent way to do that.