create temp table temp_table(work_type varchar(20), count int);
insert into temp_table
(
work_type,
count
)
select work_type,
count(work_type)
from works
where number=num
and date_in between date1 and date2
group by work_type;
CREATE PROCEDURE spisok_rabot (num INT, date1 DATE, date2 DATE)
LANGUAGE plpgsql
AS $$
DECLARE
work_type VARCHAR(20);
BEGIN
work_type := '111111111';
END;
$$