1

This is my first function:

CREATE  FUNCTION func1(INOUT a  integer,OUT b integer,  OUT c float, OUT   d integer,OUT e decimal)
 AS  $BODY$
DECLARE

BEGIN
.
.
.   
END
$BODY$
LANGUAGE plpgsql VOLATILE

Output is:

$ SELECT * FROM func1(242);

a | b | c | d | e
--+--+--+--+---

242 | 5 | 7.5 | 15 | 1.2208

And this is second function:

CREATE  FUNCTION func2()
   AS  $BODY$
DECLARE
   d  RECORD;

BEGIN
    EXECUTE 'SELECT * FROM func1(242)' INTO d;  
    raise notice 'arr: %', d;.  -– output is->  NOTICE:  arr: (242,5,7.5,15,1.2208)
--HERE I want access to a,b,....
    .
    .   
END
$BODY$
LANGUAGE plpgsql VOLATILE

How I can access separately to a,b,c,d and e variables inside func2.

1 Answer 1

1

Here's one solution:

FOR d in EXECUTE 'SELECT * FROM func1(242)'
LOOP
  --here you can access them, or assign them to a local variable
  raise notice 'a:%, b:%, c:%, d:%, e:%', d.a, d.b, d.c, d.d, d.d, d.e;
END LOOP;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.