Answer the question
In order to leave comments, you need to log in
How to set data type in postgresql functions?
Essence: it is necessary to make a loop in the function according to the results of SELECT. Simple option:
v versions%rowtype;
FOR v IN
select * from versions ver where iddoc=doc_id
LOOP
ver_id:=COALESCE(v.id,'-1');
ver_num:=COALESCE(v.number,'-1');
res:= ver_id || ver_num;
END LOOP;
v ???(versions + other_column)%rowtype;
FOR v IN
select *, verstatus(id) from versions ver where iddoc=doc_id
LOOP
ver_id:=COALESCE(v.id,'-1');
ver_num:=COALESCE(v.number,'-1');
ver_stat:=COALESCE(v.verstatus, '' );
res:= ver_id || ver_num || ver_stat;
END LOOP;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question