Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-22905 and Cast function

citicbjMay 3 2010 — edited May 4 2010
I 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 1 2010
Added on May 3 2010
6 comments
1,643 views