Dbms_space.object_growth_trend: ORA-22905
RDBMS: 10.1.0.5.0
SQL> SELECT * FROM TABLE(dbms_space.object_growth_trend('JO', 'TAB1', 'TABLE'));
SELECT * FROM TABLE(dbms_space.object_growth_trend('JO', 'TAB1', 'TABLE'))
ERROR at line 1:
ORA-22905: cannot access rows from a non-nested table itemWhy?
RDBMS: 10.1.0.5.0
SQL> SELECT * FROM TABLE(dbms_space.object_growth_trend('JO', 'TAB1', 'TABLE'));
SELECT * FROM TABLE(dbms_space.object_growth_trend('JO', 'TAB1', 'TABLE'))
ERROR at line 1:
ORA-22905: cannot access rows from a non-nested table itemWhy?
Similar Messages
-
DBMS_SPACE.OBJECT_GROWTH_TREND returns ORA-14551
Hi,
When I used DBMS_SPACE.OBJECT_GROWTH_TREND, it ran successfully but ended with an error.
SQL> SELECT * FROM V$VERSION ;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
SQL> SHOW USER
USER is "SYS"
SQL> SELECT *
2 FROM
3 table(
4 DBMS_SPACE.OBJECT_GROWTH_TREND (
5 object_owner =>'HR',
6 object_name =>'NAMES',
7 object_type =>'TABLE',
8 partition_name =>NULL,
9 start_time =>NULL,
10 end_time =>NULL,
11 interval =>to_dsinterval('0 00:10:00') ,
12 skip_interpolated => 'FALSE',
13 timeout_seconds =>NULL,
14 single_datapoint_flag =>'TRUE')
15 )
16 /
TIMEPOINT SPACE_USAGE SPACE_ALLOC QUALITY
04-OCT-09 03.58.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 04.08.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 04.18.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 04.28.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 04.38.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 04.48.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 04.58.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 05.08.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 05.18.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 05.28.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 05.38.47.421000 PM 10443367 11534336 INTERPOLATED
TIMEPOINT SPACE_USAGE SPACE_ALLOC QUALITY
04-OCT-09 05.48.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 05.58.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 06.08.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 06.18.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 06.28.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 06.38.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 06.48.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 06.58.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 07.08.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 07.18.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 07.28.47.421000 PM 10443367 11534336 INTERPOLATED
TIMEPOINT SPACE_USAGE SPACE_ALLOC QUALITY
04-OCT-09 07.38.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 07.48.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 07.58.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 08.08.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 08.18.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 08.28.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 08.38.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 08.48.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 08.58.47.421000 PM 10443367 11534336 INTERPOLATED
04-OCT-09 09.08.47.421000 PM 10443367 11534336 PROJECTED
04-OCT-09 09.18.47.421000 PM 10443367 11534336 PROJECTED
TIMEPOINT SPACE_USAGE SPACE_ALLOC QUALITY
04-OCT-09 09.28.47.421000 PM 10443367 11534336 PROJECTED
04-OCT-09 09.38.47.421000 PM 10443367 11534336 PROJECTED
04-OCT-09 09.48.47.421000 PM 10443367 11534336 PROJECTED
36 rows selected.
EXCEPTION in chrow processing - code: -14551 msg: ORA-14551: cannot perform a
DML operation inside a query*
-- changed to another table for testing
SQL> ED
Wrote file afiedt.buf
1 SELECT *
2 FROM
3 table(
4 DBMS_SPACE.OBJECT_GROWTH_TREND (
5 object_owner =>'HR',
6 object_name =>'EMPLOYEES',
7 object_type =>'TABLE',
8 partition_name =>NULL,
9 start_time =>NULL,
10 end_time =>NULL,
11 interval =>to_dsinterval('0 00:10:00') ,
12 skip_interpolated => 'FALSE',
13 timeout_seconds =>NULL,
14 single_datapoint_flag =>'TRUE')
15* )
SQL> /
TIMEPOINT SPACE_USAGE SPACE_ALLOC QUALITY
04-OCT-09 04.09.20.343000 PM 12614 65536 GOOD
EXCEPTION in chrow processing - code: -14551 msg: ORA-14551: cannot perform a
DML operation inside a queryDECLARE
v_object_owner VARCHAR2 (30):='ME';
v_object_name VARCHAR2 (30):='ACCOUNTS';
v_object_type VARCHAR2 (30):='TABLE PARTITION';
v_partition_name VARCHAR2 (30):='PAF19960501';
v_objrefcursor sys_refcursor;
r_obj_trend DBMS_SPACE.object_growth_trend_row;
CURSOR c_parts (p_owner IN VARCHAR2, p_table IN VARCHAR2)
IS
SELECT table_owner, table_name, partition_name
FROM dba_tab_partitions
WHERE table_owner = p_owner AND table_name = p_table
order by partition_name;
BEGIN
FOR r IN c_parts ('ME', 'ACCOUNTS')
LOOP
v_objrefcursor :=
DBMS_SPACE.object_growth_trend_cur (
object_owner => v_object_owner,
object_name => v_object_name,
object_type => v_object_type,
partition_name => v_partition_name,
start_time => sysdate - 120,
end_time => sysdate + 30,
interval =>null,
skip_interpolated => 'FALSE',
timeout_seconds => 360
loop
FETCH v_objrefcursor INTO r_obj_trend;
exit when v_objrefcursor%notfound;
-- if r_obj_trend.SPACE_USAGE * 1.5 <= r_obj_trend.SPACE_ALLOC THEN
DBMS_OUTPUT.PUT_LINE( v_object_name ||' '||v_partition_name
|| ' '
|| r_obj_trend.timepoint
|| ' '
|| r_obj_trend.SPACE_USAGE
|| ' '
|| r_obj_trend.SPACE_ALLOC
|| ' '
|| r_obj_trend.quality);
-- end if;
END LOOP;
end loop;
CLOSE v_objrefcursor;
END;
EXCEPTION in chrow processing - code: -1031 msg: ORA-01031: insufficient privileges
ACCOUNTS PAF19960501 18-DEC-09 06.49.07.857150 PM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 23-DEC-09 01.40.33.571436 AM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 27-DEC-09 08.31.59.285722 AM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 31-DEC-09 03.23.25.000008 PM 32768 196608 GOOD
ACCOUNTS PAF19960501 04-JAN-10 10.14.50.714294 PM 32768 196608 PROJECTED
ACCOUNTS PAF19960501 09-JAN-10 05.06.16.428580 AM 32768 196608 PROJECTED
ACCOUNTS PAF19960501 13-JAN-10 11.57.42.142866 AM 32768 196608 PROJECTED
EXCEPTION in chrow processing - code: -1031 msg: ORA-01031: insufficient privileges
ACCOUNTS PAF19960501 02-SEP-09 03.23.25.000000 PM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 06-SEP-09 10.14.50.714286 PM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 11-SEP-09 05.06.16.428572 AM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 31-DEC-09 03.23.25.000008 PM 32768 196608 GOOD
ACCOUNTS PAF19960501 04-JAN-10 10.14.50.714294 PM 32768 196608 PROJECTED
ACCOUNTS PAF19960501 09-JAN-10 05.06.16.428580 AM 32768 196608 PROJECTED
ACCOUNTS PAF19960501 13-JAN-10 11.57.42.142866 AM 32768 196608 PROJECTED
EXCEPTION in chrow processing - code: -1031 msg: ORA-01031: insufficient privileges
ACCOUNTS PAF19960501 02-SEP-09 03.23.25.000000 PM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 06-SEP-09 10.14.50.714286 PM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 11-SEP-09 05.06.16.428572 AM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 31-DEC-09 03.23.25.000008 PM 32768 196608 GOOD
ACCOUNTS PAF19960501 04-JAN-10 10.14.50.714294 PM 32768 196608 PROJECTED
ACCOUNTS PAF19960501 09-JAN-10 05.06.16.428580 AM 32768 196608 PROJECTED
ACCOUNTS PAF19960501 13-JAN-10 11.57.42.142866 AM 32768 196608 PROJECTED
EXCEPTION in chrow processing - code: -1031 msg: ORA-01031: insufficient privileges
ACCOUNTS PAF19960501 02-SEP-09 03.23.25.000000 PM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 06-SEP-09 10.14.50.714286 PM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 11-SEP-09 05.06.16.428572 AM 32768 196608 INTERPOLATED
ACCOUNTS PAF19960501 31-DEC-09 03.23.25.000008 PM 32768 196608 GOOD
ACCOUNTS PAF19960501 17-JAN-10 06.49.07.857152 PM 32768 196608 PROJECTED
ACCOUNTS PAF19960501 22-JAN-10 01.40.33.571438 AM 32768 196608 PROJECTED
ACCOUNTS PAF19960501 26-JAN-10 08.31.59.285724 AM 32768 196608 PROJECTED
EXCEPTION in chrow processing - code: -1031 msg: ORA-01031: insufficient privileges
ACCOUNTS PAF19960501 02-SEP-09 03.23.25.000000 PM 32768 196608 INTERPOLATED
Maybe not the best example but as you can see,
for every switch to a different partition I get this EXCEPTION msg.
The output seems correct otherwise.
I can create the message several different ways!
Row# BANNER
1 Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
2 PL/SQL Release 10.2.0.4.0 - Production
3 CORE 10.2.0.4.0 Production
4 TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
5 NLSRTL Version 10.2.0.4.0 - Production -
ORA-22905 with pipelined function
Hi,
I have a strange behaviour that I do not understand.
The code below does not work. It gives me the following errors:
ORA-22905: cannot access rows from a non-nested table item
ORA-06512: at line 10
ORA-06512: at line 19
The problem comes from the line 14 in that function
adm_usergroup.GET_GROUPIDS (userid_in)
If I replace the variable userid_in by its values then it perfectly works.
Can someone give me an explanation ?
The adm_usergroup.GET_GROUPIDS (userid_in) is a pipelined function that querry a group of tables and return IDs which are number.
A call to the function works fine as using it directly in a select statement.
Cheers,
Sebastien
1 DECLARE
2 l_groups AUTH_TYPE.GROUP_RT;
3 l_groups_rec authgroup%ROWTYPE;
4
5 FUNCTION GET_GROUPS (userid_in IN AUTHUSER.USERID%TYPE)
6 RETURN AUTH_TYPE.GROUP_RT
7 IS
8 l_groups_rt AUTH_TYPE.GROUP_RT;
9 BEGIN
10 OPEN l_groups_rt FOR
11 SELECT ag.*
12 FROM authgroup ag
13 WHERE AG.GROUPID IN
14 (SELECT * FROM table (adm_usergroup.GET_GROUPIDS (userid_in)));
15
16 RETURN l_groups_rt;
17 END GET_GROUPS;
18 BEGIN
19 l_groups := GET_GROUPS (1);
20
21 LOOP
22 FETCH l_groups INTO l_groups_rec;
23
24 EXIT WHEN l_groups%NOTFOUND;
25 DBMS_OUTPUT.put_line ('ID: ' || l_groups_rec.groupid);
26 END LOOP;
27
28 CLOSE l_groups;
29 END;by the way here is the full code
CREATE OR REPLACE PACKAGE AUTHDB.ADM_USERGROUP
IS
-- get the group and sub-group ids of a given user id
FUNCTION get_groupids (userid_in IN AUTHUSER.USERID%TYPE)
RETURN authgroup_set
PIPELINED;
END;
CREATE OR REPLACE PACKAGE BODY AUTHDB.ADM_USERGROUP
IS
FUNCTION get_groupids (userid_in IN AUTHUSER.USERID%TYPE)
RETURN authgroup_set
PIPELINED
IS
CURSOR group_cur
IS
SELECT mo.groupid
FROM memberof mo
WHERE MO.USERID = userid_in
UNION
SELECT gh.groupid
FROM GROUPHIERARCHY gh
CONNECT BY PRIOR GH.GROUPID = GH.PARENTGROUP_ID
START WITH GH.PARENTGROUP_ID IN (SELECT mo.groupid
FROM memberof mo
WHERE MO.USERID = userid_in);
BEGIN
FOR rec IN group_cur
LOOP
PIPE ROW (authgroup_type (REC.GROUPID));
END LOOP;
END;
END;
CREATE OR REPLACE
TYPE AUTHDB.AUTHGROUP_TYPE AS OBJECT (GROUPID NUMBER (10));
CREATE OR REPLACE
TYPE AUTHGROUP_SET AS TABLE OF authgroup_type;
DECLARE
l_groups AUTH_TYPE.GROUP_RT;
l_groups_rec authgroup%ROWTYPE;
FUNCTION GET_GROUPS (userid_in IN AUTHUSER.USERID%TYPE)
RETURN AUTH_TYPE.GROUP_RT
IS
l_groups_rt AUTH_TYPE.GROUP_RT;
BEGIN
OPEN l_groups_rt FOR
SELECT ag.*
FROM authgroup ag
WHERE AG.GROUPID IN
(SELECT * FROM table (cast(adm_usergroup.GET_GROUPIDS (userid_in) as authgroup_set)));
RETURN l_groups_rt;
END GET_GROUPS;
BEGIN
l_groups := GET_GROUPS (1);
LOOP
FETCH l_groups INTO l_groups_rec;
EXIT WHEN l_groups%NOTFOUND;
DBMS_OUTPUT.put_line ('ID: ' || l_groups_rec.groupid);
END LOOP;
CLOSE l_groups;
END; -
ORA-22905: cannot access rows from a non-nested table item in Table func
I am using a table function in Oracle 8.1.7.4.0. I did declare an object type and a collection type like this:
CREATE TYPE t_obj AS OBJECT ...
CREATE TYPE t_tab AS TABLE OF t_obj;
My table function returns t_tab and is called like this:
SELECT ... FROM TABLE (CAST (my_pkg.table_fnc AS t_tab)) ...
This works pretty well as long as I run it in the same schema that owns the function and the 2 types. As soon as I run this query from another schema, I get an ORA-22905: cannot access rows from a non-nested table item error, even though I granted execute on both the types and the function to the other user and I created public synonyms for all 3 objects.
As soon as I specify the schema name of t_tab in the cast, the query runs fine:
SELECT ... FROM TABLE (CAST (my_pkg.table_fnc AS owner.t_tab)) ...
I don't like to have a schema hard coded in a query, therefore I'd like to do this without the schema. Any ideas of how to get around this error?Richard,
your 3 statements are correct. I'll go ahead and log a TAR.
Both DESCs return the same output when run as the other user. And, running the table function directly in SQL*Plus (SELECT my_pkg.table_fnc FROM dual;) also returns a result and no errors. The problem has to be in the CAST function.
Thanks for your help. -
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.citicbj wrote:
I have checked function and found that function was defined as this:
function expense (p_exp varchar2) return number
is
l_exp number;
begin
select xxx into l_exp from xxxx where clause;
return nvl(l_exp, 0);
end expense;
So this is not defined as the table of array. So I take the table off from select statement as
select d.acct_num,
to_number(a.amt) Total Amount
from account d,
report.lib.expense (d.acct_num) a
where d.acct_num = a.acct_num;
Then it return ORA-00933 SQL command not ptoperly ended. However, I couldn't see any not properly ended SQL code here. Please advise your comments.Should just be ...
select
d.acct_num,
report.lib.expense (d.acct_num) as "Total Amount"
--to_number(a.amt) Total Amount
from account dNotice that i enclosed the column alias (Total Amount) in " ... that is because you can't have a column alias with spaces as you tried without doing this (the parser gets sad).
Also, you cannot use a function returning a single value like this as a nested table (at least not the way you are trying) and in your case there's no reason. You don't want to join to it, you are passing in ACCT_NUM which the function will presumably use to filter out not relevant data.
Finally, there's no reason to TO_NUMBER the function result ... it's already defined to return a number :) -
Space Management - DBMS_SPACE.OBJECT_GROWTH_TREND - how to execute
I am exploring the use of the package DBMS_SPACE and in particular the function OBJECT_GROWTH_TREND.
I have two problems at the moment. I am only able to execute this function when I am logged in as SYS. I would like to run the function as another user but I can't quite work out which privileges I need to grant that user. The documentation says you must have 'SYS' privileges. Execute privilege is already granted to PUBLIC so I can't see that being the problem.
In a test database where I log on as SYS I am able to execute the function however in that environment the function only returns one row with the current size when what I am interested in is a future growth projection. Does anyone know why I would only get one row ? My Oracle version is 10 g Rel 2 and below is an example of the query I used to invoke the function:
select * from table(dbms_space.OBJECT_GROWTH_TREND ('HR','EMPLOYEES','TABLE',NULL,
TO_TIMESTAMP('2008-05-16 11:00:00','YYYY-MM-DD HH:MI:SS'), TO_TIMESTAMP ('2008-06-01 11:00:00', 'YYYY-MM-DD HH:MI:SS'), INTERVAL '1' DAY ))Hi,
I have some good notes on using object_growth_trend here:
http://www.oracle-training.cc/t_oracle_segment_growth_prediction.htm
Also, consider making your own growth monitor:
http://www.dba-oracle.com/te_table_monitoring.htm
You can also see the growth of the whole database with this Oracle growth tracking script. Below is a great script to display table size changes between two periods.
column "Percent of Total Disk Usage" justify right format 999.99
column "Space Used (MB)" justify right format 9,999,999.99
column "Total Object Size (MB)" justify right format 9,999,999.99
set linesize 150
set pages 80
set feedback off
select * from (select to_char(end_interval_time, 'MM/DD/YY') mydate, sum(space_used_delta) / 1024 / 1024 "Space used (MB)", avg(c.bytes) / 1024 / 1024 "Total Object Size (MB)",
round(sum(space_used_delta) / sum(c.bytes) * 100, 2) "Percent of Total Disk Usage"
from
dba_hist_snapshot sn,
dba_hist_seg_stat a,
dba_objects b,
dba_segments c
where begin_interval_time > trunc(sysdate) - &days_back
and sn.snap_id = a.snap_id
and b.object_id = a.obj#
and b.owner = c.owner
and b.object_name = c.segment_name
and c.segment_name = '&segment_name'
group by to_char(end_interval_time, 'MM/DD/YY'))
order by to_date(mydate, 'MM/DD/YY');
Hope this helps. . .
Donald K. Burleson
Oracle Press author
Author of "Oracle Tuning: The Definitive Reference":
http://www.dba-oracle.com/bp/s_oracle_tuning_book.htm -
DBMS_SPACE.OBJECT_GROWTH_TREND without Diagnostics Pack
Hi ,
Can i use DBMS_SPACE.OBJECT_GROWTH_TREND without Diagnostics Pack? As per the docs this procedure uses AWR for information retrieval.
Also I've seen that there are multiple bugs related to this in <10.2.0.3. Can some one share their experiences with this option.
My objective here is to observe past object growth at database/object level. This seems to be the ONLY option provided by oracle for this.Any other hints apart from custom scripts.
Thanks
RaviThanks for the info Brain.
As per the licencing docs AWR is part of Diagnostics pack. I'm not supposed to access any AWR tables without proper licence. It also mentions set of packages which will use the AWR information and i'm not supposed to use those packages as well. But no where in the licencing document there is a information about DBMS_SPACE package.
Having said all this, licencing doc also mentions that there are few tables/view that start with DBA_HIST, which can be used WITHOUT licence.
I need to know if there is any clear YES or NO kind of information for my question. Any information you have will be highly helpful.
Thanks,
Ravi.M -
ORA-22905: cannot access rows from a non-nested table item
Hi All,
This is the overview of the query used in the package.
select ename,empno,sal,deptno from
(select deptno from dept) a,
(select ename,empno,sal from emp1) b
where empno in (select * from table (pkg1.fun1('empno')))
and a.deptno=b.deptno
union
select ename,empno,sal,deptno from
(select deptno from dept) c,
(select ename,empno,sal from emp2) d
where empno in (select * from table (pkg1.fun1('empno')))
and c.deptno=d.deptno
Here the pkg1.fun1 will convert the string ('empno') into table form. ('empno') is the input parameter to the package and is a string of emp numbers.
compilation is successful. when this is executed the below error pops up
"ORA-22905: cannot access rows from a non-nested table item"
Is there any problem with the table function which i am using in this query
could anyone guide me to the solution.
Thanks AllI have used
CREATE OR REPLACE
type tab_num as table of number;
select * from table (cast(pkg1.fun1('empno')) as tab_num))
This throws an error during compilation itself
"PL/SQL: ORA-00932: inconsistent datatypes:expected number got varchar2 -
Dear All,
I have one function as follows;
CREATE OR REPLACE TYPE split_tbl IS TABLE OF number;
CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
l_idx PLS_INTEGER;
l_list VARCHAR2(32767) := p_list;
l_value VARCHAR2(32767);
BEGIN
LOOP
l_idx := INSTR(l_list, p_delim);
IF l_idx > 0 THEN
PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
ELSE
PIPE ROW(l_list);
EXIT;
END IF;
END LOOP;
RETURN;
END SPLIT;
Now I am createing new function as follows;
create or replace function sm_imagetext_data (mstring in varchar2)
return blob
is
cursor c1 is
select COLUMN_VALUE from table(split(mstring,','));
l_sm_imagetextid number;
l_data blob;
l_data1 blob;
begin
open c1;
loop
fetch c1 into l_sm_imagetextid;
--select COLUMN_VALUE into l_sm_imagetextid from table(split(mstring,','));
select data into l_data from sm_imagetext where sm_imagetextid = l_sm_imagetextid ;
l_data1 := l_data;
end loop;
return l_data1;
--close c1;
end;
But while executing
select sm_imagetext_data('7,8') from dual;
I received ORA -22905 error.
why this errors occoured.
Thanks in advance.create or replace function sm_imagetext_data (mstring
in varchar2)
return blob
Here the return is BLOB
select sm_imagetext_data('7,8') from dual;SQL*Plus can't handle BLOBs.
Use DBMS_LOB package to do something for LOBs.
CHeers
Sarma. -
Oracle error ORA-22905: cannot access rows from a non-nested table item
Oracle error ORA-22905: cannot access rows from a non-nested table item
Creating a report using oracle plsql code .
Getting error ;
Oracle error ORA-22905: cannot access rows from a non-nested table item
when I am trying to pass data in clause in pl sql proc
basically I have a proc which takes 2 parameters(a and b)
proc (
P_a varchar2,
p_b varchar2,
OUT SYS_REFCURSOR
culprit code which is giving me the error and on google they say cast it but I dont know how to do it in my context
--where id in (
-- SELECT * FROM THE (SELECT p_cd_common.get_table_from_string(P_a) FROM dual)
-- union
-- SELECT * FROM THE (SELECT p_cd_common.get_table_from_string(P_b) FROM dual)
data sample returned from this :SELECT * FROM THE (SELECT p_cd_common.get_table_from_string(P_a) FROM dual)
'Abc','def',
data sample returned from this;SELECT * FROM THE (SELECT p_cd_common.get_table_from_string(P_b) FROM dual)
'fgd','fth',
Any answers ?
How to pass data in clause in a better wayWhy are you creating a duplicate post? I already asked you to post p_cd_common.get_table_from_string. In particular what is function return type and where it is declared. As I already mentioned, most likely function return type is declared in the package and therefore is PL/SQL type. And TABLE operator can only work with SQL types.
SY. -
Greetings Gurus,
I'm getting an ORA-22905 when I try and do a full outer join in the following function. If I include the commented lines in the perstren_diff_recs2 function I get the error. Both halfs of the union query work by themselves. When I union them bam error. Also, when I use the full outer join syntax the Oracle session craps the bed with a end of file communication error. That is why I'm using the simulated full outer join.
My goal was to abstract the XML in my queries. The results from the pipelined function is a delta between what is in the XML document and a relational base table.
Derrick
CREATE OR REPLACE PACKAGE XML_UTILS is
TYPE perstren_typ is record (
uic varchar2(6),
tpers varchar2(2),
deply varchar2(6),
secur varchar2(1),
struc number(4),
auth number(4)
TYPE perstren_diff_typ is record (
uic varchar2(6),
transaction_type char(1),
tpers varchar2(2),
deply varchar2(6),
secur varchar2(1),
struc number(4),
auth number(4)
TYPE perstrenSet is table of perstren_typ;
TYPE perstrenDiffSet is table of perstren_diff_typ;
function perstren_recs (uic varchar2) return perstrenSet pipelined;
function perstren_diff_recs2 (uic varchar2) return perstrenDiffSet pipelined;
end;
CREATE OR REPLACE PACKAGE BODY XML_UTILS is
function perstren_diff_recs2 (uic varchar2) return perstrenDiffSet pipelined is
cursor perstren_recs_cur(in_uic varchar2) is
select p.uic, p.tpers, p.deply, P.secur, p.struc,p.auth,
doc.uic as xmluic,
doc.tpers as xmltpers,
doc.deply as xmldeply,
doc.secur as xmlsecur,
doc.struc as xmlstruc,
doc.auth as xmlauth
from perstren_bac p left outer join
table(xml_utils.perstren_recs(in_uic)) doc
on (p.uic = doc.uic and
p.tpers = doc.tpers and
p.deply = doc.deply)
where p.uic = in_uic;
-- union
-- select p.uic, p.tpers, p.deply, P.secur, p.struc,p.auth,
-- doc.uic as xmluic,
-- doc.tpers as xmltpers,
-- doc.deply as xmldeply,
-- doc.secur as xmlsecur,
-- doc.struc as xmlstruc,
-- doc.auth as xmlauth
-- from perstren_bac p right outer join
-- table(xml_utils.perstren_recs(in_uic)) doc
-- on (p.uic = doc.uic and
-- p.tpers = doc.tpers and
-- p.deply = doc.deply)
-- where doc.uic = in_uic;
out_rec perstren_diff_typ;
begin
for cur_rec in perstren_recs_cur(uic) loop
if cur_rec.xmldeply is not null and cur_rec.xmltpers is not null then
out_rec.uic := cur_rec.xmluic;
out_rec.tpers := cur_rec.xmltpers;
out_rec.deply := cur_rec.xmldeply;
out_rec.secur := cur_rec.xmlsecur;
out_rec.struc := cur_rec.xmlstruc;
out_rec.auth := cur_rec.xmlauth;
else
out_rec.uic := cur_rec.uic;
out_rec.tpers := cur_rec.tpers;
out_rec.deply := cur_rec.deply;
out_rec.secur := cur_rec.secur;
out_rec.struc := cur_rec.struc;
out_rec.auth := cur_rec.auth;
end if;
if cur_rec.uic is not null and cur_rec.xmldeply is not null and cur_rec.xmltpers is not null and (
nvl(cur_rec.secur,'XX') != nvl(cur_rec.xmlsecur,'XX') or
nvl(cur_rec.struc,9999) != nvl(cur_rec.xmlstruc,9999) or
nvl(cur_rec.auth,9999) != nvl(cur_rec.xmlauth,9999)) then
out_rec.transaction_type :='U';
elsif cur_rec.uic is null and cur_rec.xmldeply is not null then
out_rec.transaction_type :='I';
elsif cur_rec.uic is not null and cur_rec.xmldeply is null then
out_rec.transaction_type :='D';
else
out_rec.transaction_type :='O';
end if;
PIPE row (out_rec);
end loop;
exception
when others then
if perstren_recs_cur%isopen then
close perstren_recs_cur;
end if;
raise;
return;
end;
function perstren_recs (uic varchar2) return perstrenSet pipelined is
cursor perstren_recs_cur(in_uic varchar2) is
select uic,
extractvalue(Column_value,'/PERSTREN/TPERS') as TPERS,
extractvalue(Column_value,'/PERSTREN/DEPLY') as DEPLY,
extractvalue(Column_value,'/PERSTREN/SECUR') as SECUR,
extractvalue(Column_value,'/PERSTREN/STRUC') as STRUC,
extractvalue(Column_value,'/PERSTREN/AUTH') as AUTH
from test_ref ref,
table(XMLSequence(extract(ref.XML_DOC,'/RasDataSet/PerstrenList/PERSTREN'))) per
where ref.uic = in_uic;
out_rec perstren_typ;
begin
open perstren_recs_cur(uic);
loop
fetch perstren_recs_cur into out_rec;
exit when not perstren_recs_cur%FOUND;
PIPE row (out_rec);
end loop;
close perstren_recs_cur;
exception
when others then
if perstren_recs_cur%isopen then
close perstren_recs_cur;
end if;
raise;
return;
end;
end;Oracle bug when executing the query in a function
-
ERROR:-22905:ORA-22905: cannot access rows from a non-nested table item
Hi. I have some code running on oracle 9i that gives me above error.
Following are my type declarations.
drop type_obj_tea_icore_glr;
drop type_tbl_tea_icore_glr;
create or replace type type_obj_tea_icore_glr as object (
ns_comp_id_parent number,
ns_comp_id_child number,
serv_item_id number,
glr_display_order number,
exchange_carrier_circuit_id varchar2(53)
show err
create or replace type type_tbl_tea_icore_glr as table of type_obj_tea_icore_glr;
show err
I have a function in an oracle package tea_icore_pkg with following signature.
FUNCTION sortpvcdesign (
p_document_number serv_req_si.document_number%TYPE,
p_pvc_serv_item_id serv_item.serv_item_id%TYPE,
p_orig_port_serv_item_id serv_item.serv_item_id%TYPE
RETURN type_tbl_tea_icore_glr
If I run following from SQL prompt, it works fine.
SELECT * FROM TABLE (tea_icore_pkg.sortpvcdesign(255082,2782636,2723752) );
But when I use that within another procedure of the same packge, as follows:
FOR glr_rec IN
(SELECT *
FROM TABLE
(CAST
(sortpvcdesign (c_pvcs.order_nbr,
c_pvcs.pvc_serv_item_id,
c_pvcs.orig_port_serv_item_id
) AS type_tbl_tea_icore_glr
LOOP
At the runtime, I got the above error message ( as referred to in subject ). I took all of the suggestions on CAST without much success. The user/schema is only one schema here. I mean, no permissions issue. I granted all on above types to public.
Can someone help?Bil,
I tried both with CAST and without CAST with specifying the colums. The same error.
OR glr_rec IN
(SELECT ns_comp_id_parent, ns_comp_id_child, serv_item_id,
glr_display_order, exchange_carrier_circuit_id
FROM TABLE
(CAST
(sortpvcdesign (c_pvcs.order_nbr,
c_pvcs.pvc_serv_item_id,
c_pvcs.orig_port_serv_item_id
) AS type_tbl_tea_icore_glr
LOOP -
[ORA-22905] How to read a field of an object inside another object?
Greetings,
I'm a student and in a current exercise we have to work with the Object Oriented Programming functionality of Oracle.
In the database we defined an object type, which is then considered inside another object type. The thing is, that I cannot read an attribute of the inner object. I've read tens of websites but none of them have helped so far. I've read the PL/SQL User Guide and Reference document also.
The inner object is defined as follows:
create type address_t as object (
street varchar(50),
city varchar(50),
pcode number(5,0)
);The outer object has an object of type address_t inside it:
CREATE TYPE professor_t as OBJECT(
code number(2),
p_name varchar(50),
address address_t,
);Also, there is a table named PROFESSORS that stores objects of type professor_t
First of all, with a simple testing SQL statement I can see the data inside the object professor, even the object address_t:
SELECT * FROM PROFESSORS WHERE CODE = 13;returns the following:
CODE | NAME | ADDRESS
13 | JOHN | MYSCHEMA.ADDRESS_T('FIFTH AVENUE','NEW YORK',12345)The thing is, I want to read the field street of the object address (of type address_t) inside professor (of type professor_t).
I could see everywhere that the way to go is to use point notation, and I've seen examples about the command VALUE, but none of the following SQL statements work:
SELECT VALUE(ADDRESS.STREET) FROM(
SELECT CODE,P_NAME,ADDRESS FROM PROFESSORS WHERE CODE = 13);
SELECT ADDRESS.STREET FROM PROFESSORS WHERE CODE = 13;
SELECT PROFESSOR.ADDRESS.STREET FROM PROFESSORS WHERE CODE = 13;I'd really appreciate if someone could show me how to access the values of the field of the object inside an object.
Thanks in advance,
- David
Edited by: 858176 on May 11, 2011 6:53 PM FormattingGreat, this worked so far.
It is curious that you wrote 'profesores' but that is the actual name for the variable. I translated everything to english in order to post it here.
So, the statement is:
select value(t).DIRECCION.CIUDAD from profesores t;And It returned:
VALUE(T).DIRECCION.CIUDAD
Valencia
New York
TijuanaAnd, applying the VALUE command to the statement:
select codigo,
nombre,
value(t).DIRECCION.CALLE,
value(t).DIRECCION.CIUDAD,
value(t).DIRECCION.CP
from profesores T WHERE T.CODIGO = 13;Resulting in:
CODIGO NOMBRE VALUE(T).DIRECCION.CALLE VALUE(T).DIRECCION.CIUDAD VALUE(T).DIRECCION.CP
13 Pepito Pérez Calle de los Rosales 0 Valencia 46023 That is EXACTLY what I needed.
Thanks Thomas, It was really helpful !
Edited by: 858176 on May 11, 2011 7:46 PM -
DBMS_SPACE throwing exception
Hi everyone,
I was wondering if anyone can help me ? I'm trying to see how much my table is growing by calling this:
SELECT *
FROM TABLE(DBMS_SPACE.object_growth_trend ('SCOTT','EMP','TABLE'))
ORDER BY timepoint;And I'm getting this issue:
ORA-01804: failure to initialize timezone information
ORA-06512: at "SYS.DBMS_SPACE", line 3062
ORA-06512: at "SYS.DBMS_SPACE", line 4230
ORA-06512: at line 1
01804. 00000 - "failure to initialize timezone information"
*Cause: The timezone information file was not properly read.
*Action: Please contact Oracle Customer Support.I'm on Oracle 10g
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production Does anyone know what's wrong?
Thanks for your help!ORA-1804 indicates that the database cannot load the time zone file it wants to use. This error will come up every time that a named time zone is used and the time zone file is not available or corrupt.
So simply follow
*Action: Please contact Oracle Customer Support. -
DBMS_SPACE(9i) for tablespace growth trend..?
Hello,
for 10G, dbms_space.object_growth_trend() can expect table's growth....
for 9i (9.2.0.6 in Sun9) database, is there any friend has experience know how to do for the following purpose:
1. How to expect tablespace growth? say, to accommodate new data for the next 30 days we have to increase tablespace A by X GB, tablespace B by Y GB, … etc
2. How to expect database level growth? say, we need XXX GB more to accommodate new data for the year YYYY
3, Is there any way to Initialize (if possible) Segment Advisor with the information about segment trends we have already collected in 9i
Thank you in advance
JerryHi..
AFAIK in 9i you can't find the Subprograms like object_growth_trend() package in dbms_space.
How to expect tablespace growth? I think that you will have to maintain a sheet of the tablespace usage.Daily you will need to maintain the tablespace size, used and free size of tablespace.Ans after few days of observation you can predict the approximate amount of size being filled up in a day.
You can use the below query to know the used and the free space in the tablespace.
select df.tablespace_name tspace,
df.bytes/(1024*1024) tot_ts_size,
(df.bytes/(1024*1024) -sum(fs.bytes)/(1024*1024)) Used_ts_size,
sum(fs.bytes)/(1024*1024) free_ts_size,
round(sum(fs.bytes)*100/df.bytes) free_pct,
round((df.bytes-sum(fs.bytes))*100/df.bytes) used_pct1
from dba_free_space fs, (select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name ) df
where fs.tablespace_name = df.tablespace_name
group by df.tablespace_name, df.bytes
order by 1
2. How to expect database level growth? Again same, you need to maintain a sheet for it.Use the below query
select sum(bytes/1024/1024/1024) Physical_size_gb from dba_data_files;
select sum(bytes/1024/1024/1024) Actual_size_gb from dba_segments; 3, Is there any way to Initialize (if possible) Segment Advisor with the information about segment trends we have already collected in 9iNo.
HTH
Anand
Edited by: Anand... on Jan 6, 2009 4:17 AM
Maybe you are looking for
-
Which Photoshop should I buy ??
Hello, I am interested in buying photoshop and start learning how to edit photos for my boutique (online). My main function would be to edit photos ( to make the clothes color look vivid, make models look slimmer. or etc..) I have NO CLUE on what eac
-
Programmable filter for NI6289?
Hello, It seems NI6289 M series PCI DAQ does not have a programmable filter? http://www.ni.com/dataacquisition/find_product_by_application.htm Is it right? Are there any way I can set a lowpass filter such as calling some C functions? Do the followin
-
Hi, all. The database is 2 node RAC (10.2.0.2.0) on 32-bit windows 2003 EE SP1. One session on Node 2 is waiting for "library cache lock" to be released for "178874" seconds. The detail for the session is as follows: SID : 444 TYPE : USER PROGRAM : O
-
i have a new ipad and stupid as it may sound I cannot physically plug the charger in to the ipad. Can I damage the ipad if I force the charger into the port?
-
Hi All, I am looking for a tool that logs all activities that happen on the database, locally, and remotely, such as select statements, backups, data exporting, etc. Because we host data from many resources, these resources want to make sure that the