postgresql – postgreql 11: how to get result of a query in set of records and then process them in a function


I want to write a function like below.Whats wrong in it?

CREATE OR REPLACE FUNCTION myFunc(abc BIGINT, sss myTable.Col1%Type) AS 
DECLARE 
myRec RECORD;
tab_Rec RECORD(); --This i want to as a table (i dont know the column details though). 
--Declaring it as array fails

BEGIN
SELECT INTO myREC FROM public.myOtherFunc(abc, sss);

--Returns a table i.e. multiple rows and columns
SELECT * INTO tab_Rec FROM public.myAddFunc(abc);

--I want to do this now
for x in 1 .. array_length(tab_Rec, 1)
loop
         ---some logic
end loop;


END;