ORA-22905 and Cast function
citicbjMay 3 2010 — edited May 4 2010I am running a query with following code:
select d.acct_num, lib.fmt_money(a.amt) Total Amount
from account d, table(report.lib.expense (d.acct_num)) a
where clause.
Here:
1. Report is another schema containing packqges for reporting development.
2. lib is package name created in the report schema. It contains function such as expense.
3. expense is a function under Lib package as
function expense (p_acct number) return number is
acct_num number;
begin select xxxx into acct_num from xxx_table); return nvl(acct_num, 0);
end expense;
Then when I run this select statement, it gave me ORA-22905 error. Cause: attempt to access rows of an item whose type is not known at parse time or that is not of a nested table type. Action: use CAST to cast the item to a nested table type.
I used CAST like this:
select d.acct_num, CAST(a.amt as number ) Total Amount
from account d, table(report.lib.expense (d.acct_num)) a
where clause.
It gave me ORA-00923 From keyword not found where expected.
Please help me to find where the problem is and thank you for your help a lot.