I recently installed an Oracle 12c in Oracle Linux 7.6, it was previously in Windows. In the first database restored, some functions are with compilation errors.
The query below informs you that there is a syntax error on line 2, but I can not figure out where the problem is.
Error: Error (2.17): PLS-00201: The identifier 'DAYS_INTERVAL_TABLE' must be declared
Query:
create or replace FUNCTION funRetornaDias (p_inicio date, p_termino date)
RETURN DAYS_INTERVAL_TABLE PIPELINED IS
v_date date;
out_rec DAYS_INTERVAL := DAYS_INTERVAL(NULL,NULL);
v_ref date;
BEGIN
if p_inicio > p_termino then
v_ref := p_inicio;
v_date := p_termino;
else
v_ref := p_termino;
v_date := p_inicio;
end if;
while cast(to_char(v_date, 'YYYYMMDD') as number) <= cast(to_char(v_ref, 'YYYYMMDD') as number) loop
begin
out_rec.date_ := v_date;
out_rec.day_of_week := datepart('DW', v_date);
PIPE ROW(out_rec);
v_date := v_date + interval '1' day;
end;
end loop;
RETURN;
END;