I am trying to write a function to return a list of code.
In the package spec I have declared
type codes_t is table of number;
and
function getCodes(
acc_id in Account.id%type
)
return codes_t;
In the body I have
function getCodes(
acc_id in Account.id%type
)
return codes_t
is
v_codes codes_t := codes_t();
begin
for row in (select ...) loop
v_codes.extend();
v_codes(v_codes.count) := row.code;
end loop;
return codes_t;
The package compilers without errors but when I try to call the function with
select pkg.getCodes(123) from dual;
I get ORA-00902: Invalid datatype
Anything obviously wrong?