Я успешно создал функцию.Я хочу вернуть несколько курсоров ссылок, как показано ниже.Когда я выполняю функцию, я получаю ответ, как на картинке ниже.Как я могу решить эту проблему?
CREATE OR REPLACE FUNCTION public.get_dashboard_graph(
p_fromdate character varying,
p_todate character varying)
RETURNS SETOF refcursor
LANGUAGE 'plpgsql'
COST 100.0
VOLATILE
ROWS 1000.0
AS $function$
DECLARE
process_wise_positrol refcursor;
process_wise_micro_audit refcursor;
process_wise_positrol_line_stop refcursor;
process_wise_micro_audit_line_stop refcursor;
BEGIN
-- process wise positrol completed
OPEN process_wise_positrol FOR
select count(*), d.dd_value from audit_transaction t, audit_master m, dd_type_details d
where t.audit_id = m.audit_id and m.activity_id = 9 and t.iscompleted = 'completed' and d.dd_id = m.process
and audit_start_time BETWEEN p_fromdate::timestamp AND p_todate::timestamp group by d.dd_value;
RETURN NEXT process_wise_positrol;
-- process wise Micro audit completed
OPEN process_wise_micro_audit FOR
select count(*), d.dd_value from audit_transaction t, audit_master m, dd_type_details d
where t.audit_id = m.audit_id and m.activity_id = 8 and t.iscompleted = 'completed'
and d.dd_id = m.process
and audit_start_time BETWEEN p_fromdate::timestamp AND p_todate::timestamp group by d.dd_value;
RETURN NEXT process_wise_micro_audit;
-- process wise positrol line stop
OPEN process_wise_positrol_line_stop FOR
select count(*), d.dd_value from audit_transaction t
left join audit_master m on m.audit_id= t.audit_id
left join dd_type_details d on d.dd_id= m.process
left join audit_ques_link al on al.audit_trans_id= t.audit_trans_id
where t.audit_id = m.audit_id and m.activity_id = 9 and al.line_stop = 0
and t.iscompleted = 'completed' and d.dd_id = m.process
and audit_start_time BETWEEN p_fromdate::timestamp AND p_todate::timestamp
group by d.dd_value;
RETURN NEXT process_wise_positrol_line_stop;
-- process wise Micro audit line stop
OPEN process_wise_micro_audit_line_stop FOR
select count(*), d.dd_value from audit_transaction t
left join audit_master m on m.audit_id= t.audit_id
left join dd_type_details d on d.dd_id= m.process
left join audit_ques_link al on al.audit_trans_id= t.audit_trans_id
where t.audit_id = m.audit_id and m.activity_id = 8 and al.line_stop = 0
and t.iscompleted = 'completed' and d.dd_id = m.process
and audit_start_time BETWEEN p_fromdate::timestamp AND p_todate::timestamp
group by d.dd_value;
RETURN NEXT process_wise_micro_audit_line_stop;
END;
$function$;
ALTER FUNCTION public.get_dashboard_graph(character varying, character varying)
OWNER TO postgres;
Когда я выполняю вышеуказанную функцию, она возвращает вывод, как показано ниже.
select * from get_Dashboard_Graph('09/01/2018','09/28/2018');
![enter image description here](https://i.stack.imgur.com/QMGc4.png)