1

i create function / stored procedure on POSTGRESQL with jsonb table, the problem is return only one row not all row.

CREATE OR REPLACE FUNCTION "public"."someprocedure"("begindate" date, "endate" date)
RETURNS TABLE("a" text, "b" text) 
AS $BODY$
declare 
BEGIN
    RETURN QUERY
    select data->>'a' as a,
           data->>'b' as b 
    from table 
    where cast(timestamp as date) >= '2019-07-18' 
      and cast(timestamp as date) <> '2019-08-01' ;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;

expected:

table a | table b
data a  | data b

reality:

someprocedure
a,b
2
  • How exactly are you using that function? Commented Aug 28, 2019 at 8:57
  • 1
    I guess a duplicate of e.g.: stackoverflow.com/questions/7072021 Commented Aug 28, 2019 at 8:59

0

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.