Forall with nested table
i have a procedure with a paremeter which is nested table of an object type. is it possible to use forall statement to insert into the table in the below case. can someone post the syntax in this case please. thanks.
proc1( param1,
in_items_arr
is
begin
FOR i in in_items_arr.FIRST .. in_items_arr..LAST LOOP
INSERT INTO tbl_items (col1,
col2,
col3,
VALUES ( parm1,
in_items_arr(i).item_id,
in_items_arr(i).requested_qty
END LOOP;
end;
rajugopalli wrote:
i am getting the below error when i used FORALL. what is that i am doing wrong? thanks
Error(396,9): PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND table of records
And what is that you don't understand in:
Error(396,9): PLS-00436: implementation <font size=5 color=red>restriction</font>: cannot reference fields of BULK In-BIND table of recordsFeature you are trying to use is implemented in 11g. In all prior versions you must use separate collections for each inserted expression.
SY.
Similar Messages
-
Import tables with nested table : ORA-00600
In Oracle 9.2
Create object, type as table, and table with nested table (store as syms_ntab) are successfully.
Also its export.
In process of import on another server (also 9.2, 'fromuser=one touser=two') shows errors:
. . importing table "SYMS_NTAB"
IMP-00058: ORACLE error 600 encountered
ORA-00600: internal error code, arguments: [kokeeafi1], [2], [2], [], [], [], [], []
IMP-00075: Warning: The nested table may contain partial rows or duplicate rows
But for all that table is created and error occur on phase inserting strings.
What is this?
In Oracle 8.0.5 i perform similar operation without error.From Oracle error messages and codes manual:
ORA-00600 internal error code, arguments: [string], [string], [string], [string], [string], [string], [string], [string]
Cause: This is the generic internal error number for Oracle program exceptions. It indicates that a process has encountered a low-level, unexpected condition. Causes of this message include:
* timeouts
* file corruption
* failed data checks in memory
* hardware, memory, or I/O errors
* incorrectly restored files
The first argument is the internal message number. Other arguments are various numbers, names, and character strings. The numbers may change meanings between different versions of Oracle.
Action: Report this error to Oracle Support Services after gathering the following information:
* events that led up to the error
* the operations that were attempted that led to the error
* the conditions of the operating system and databases at the time of the error
* any unusual circumstances that occurred before receiving the ORA-00600 message
* contents of any trace files generated by the error
* the relevant portions of the Alter files
Note: The cause of this message may manifest itself as different errors at different times. Be aware of the history of errors that occurred before this internal error. -
PL/SQL add procedure with nested table - Duplicate Thread
Hi,
I am trying to do a procedure to input information for one order and another for 2 orders.
The information I have so far is as follows:
Drop table Orders cascade constraints;
Drop type item_type;
Drop type Item_nested;
Create or Replace Type item_type AS Object (
Cat_code Varchar2(6),
Amount_ord Number(3),
Cost Number(5,2) );
Create or Replace Type item_nested as table of item_type;
Create Table Orders (
Order_no Varchar2(8) constraint pkorder primary key,
Customer_name Varchar2(30),
AddressLine1 Varchar2(20),
AddressLine2 Varchar2(20),
AddressLine3 Varchar2(20),
Town Varchar2(20),
Postcode Varchar2(10),
Country Varchar2(20),
Order_items item_nested,
Order_date Date)
Nested Table Order_items
Store as nested_items return as locator;
This has so far worked but I have not managed the insert procedure.
I am using Oracle SQL*plus
Thanks
SG
Edited by: user10689875 on 11-Jan-2009 03:39Duplicate thread ->
PL/SQL add procedure with nested table
Please remove it & marked it as duplicate.
Regards.
Satyaki De. -
Partition exchange error on table with nested table
On Oracle 11.2.0.1, I have a partitioned table with some partitions that need to be 'archived' (in terms of moving partitions to an 'archive' table).
I have a source table like:
CREATE TABLE IS_PODACI245
ID_OBJEKTA_IDENTIFIKACIJA NUMBER(10),
ID_OBJEKTA NUMBER(20),
DATUM TIMESTAMP(6) NOT NULL,
TZ NUMBER(3),
DATA1 NUMBER(10),
DATA2 NUMBER(6),
DATA3 NUMBER(10),
DATA4 NUMBER,
DATA5 T_NTCIP_CLIMATE_TABLE
NESTED TABLE DATA5 STORE AS IS_PODACI245_STORE_TABLE
TABLESPACE DATA
PARTITION BY RANGE (DATUM)
PARTITION P_201107 VALUES LESS THAN (TIMESTAMP' 2011-08-01 00:00:00')
LOGGING
NOCOMPRESS
TABLESPACE DATA,
PARTITION P_MAXVALUE VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE DATA
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
CREATE INDEX IDX_IS_PODACI245_KOMPLEKS ON IS_PODACI245
(ID_OBJEKTA_IDENTIFIKACIJA, ID_OBJEKTA, DATUM)
TABLESPACE DATA
LOCAL (
PARTITION P_201107
LOGGING
NOCOMPRESS
TABLESPACE DATA,
PARTITION P_MAXVALUE
LOGGING
NOCOMPRESS
TABLESPACE DATA
NOPARALLEL;
CREATE OR REPLACE TYPE t_ntcip_climate_table as table of t_ntcip_climate_fmt;
CREATE OR REPLACE TYPE t_ntcip_climate_FMT as object
( dev_index number(6)
, dev_description varchar2(512)
, dev_type number(10)
, dev_status number(10)
, dev_mfr_status varchar2(512)
, dev_active number(3)
, dev_test_activation number(10)
/I would like to make exchange partition using stage table, and everything is going fine on all tables, but only on a few of them (listed source is one of them, and they're only tables with nested tables wihin), where I get an error.. but sometimes ;)
on a statement like:
ALTER TABLE IS_PODACI245_ARH EXCHANGE PARTITION P_201106 WITH TABLE IS_PODACI245_STAGE EXCLUDING INDEXES WITHOUT VALIDATION;I got an error:
ORA-00001: unique constraint (TXV.SYS_C0032911) violated
it's an unique index between parent and nested table.
what could cause that problem?Dear,
I suppose that the unique constraint
ORA-00001: unique constraint (TXV.SYS_C0032911) violatedis the one you 've created on the nested table IS_PODACI245_STORE_TABLE
If so, why not disable that constraint and try again.
I have never exchanged such a kind of partitioned table having a nested table in it. But, I could imagine that the cloned non partitioned table IS_PODACI245_STAGE should at least be the exact image of the partitioned table IS_PODACI245_ARH (of course without the partition part) but with the nested table part and including all indexes
In addition, if you have a parent/child relationship between your partitioned tables, then there is a chronological order of exchange starting by the child and then finishing by the parent
see the following link for more information about this order of exchange (and comment 2 for an example also)
http://jonathanlewis.wordpress.com/2006/12/10/drop-parent-partition/#more-65
Hope this helps
Mohamed Houri -
Problem when expanding Tree - Tree with nested table column
Hi, i have created the tree using the Tree with nested table column.
I have created a node called TREE_ROOT in the context.
This node has few attributes which includes children_loaded, is_leaf, is_expanded.
I have created the recursive node TREE_SUB for the above node TREE_ROOT.
In the view, i have created the table with the master column. The above attributes have been mapped accordingly. I have created the action handler for load_children.
In this action handler method, i receive the context_element correctly. In this method, i determine the children of the selected element and the resulting children are attached to this context_element.
But the problem is: when i add elements to context_elements in the method load_children, these
elements get added to the node TREE_ROOT as well.
Please help.
thanks and best regards,
PramodI just use some types defined in this user... Well, I hope you know what is the type definition of d_period_sec,
don't you ? I didn't ask to provide all types existed now, only types you are
using.
Anyhow you have been granted with execute privilege for types you are using:
SQL> conn tau_tll/tau_tll;
Connected.
SQL> create or replace type d_period_sec as object (date# date);
2 /
Type created.
SQL> grant execute on d_period_sec to public with grant option;
Grant succeeded.
SQL> conn scott/tiger
Connected.
SQL> CREATE OR REPLACE TYPE unit_function AS OBJECT (
2 xi NUMBER,
3 yi NUMBER,
4 xe NUMBER,
5 ye NUMBER,
6 xm NUMBER,
7 ym NUMBER,
8 v NUMBER,
9 a NUMBER,
10 f NUMBER,
11 descr VARCHAR2 (20)
12 );
13 /
Type created.
SQL> grant execute on unit_function to master;
Grant succeeded.
SQL> CREATE OR REPLACE TYPE unit_moving_point AS OBJECT
2 (
3 p tau_tll.d_period_sec, -- from user TAU_TLL
4
5 m unit_function
6 )
7 /
Type created.
SQL> grant execute on unit_moving_point to master;
Grant succeeded.
SQL> CREATE OR REPLACE TYPE moving_point_tab AS TABLE OF unit_moving_point;
2 /
Type created.
SQL> grant execute on moving_point_tab to master;
Grant succeeded.
SQL> CREATE OR REPLACE TYPE moving_point AS OBJECT (u_tab moving_point_tab);
2 /
Type created.
SQL> grant execute on moving_point to master;
Grant succeeded.
SQL> conn master/master
Connected.
SQL> CREATE TABLE MPOINTS (
2 id NUMBER,
3 mpoint scott.Moving_Point)
4 NESTED TABLE mpoint.u_tab store as moving_tab;
Table created.Rgds. -
ANSI Standard Join with Nested Table
Does anyone know how to (or whether you actually can) use ansi standard table joins with nested tables.
Non-ansi standard would look something like this
SELECT e.empno
FROM departments d, TABLE(d.employees) e
WHERE d.deptno = 10;
Where d.employees is a nested table.
But if I try ansi-standard I like such:
SELECT e.empno
FROM departments d
JOIN TABLE(d.employees) e
WHERE d.deptno = 10;
I get
ORA-00905: missing keyword
because I have nothing to join it on.
Your help is very much appreciatedBoth replies worked fine.
I think I will go with the NATURAL JOIN as it seems the cleanest option.
Thanks Guru 2748 -
Fill datagridview with Nested Table Object Type ???
Hello everybody, please you help me resolve my problem?
I follow this example: *(A Sample Application using Object-Relational features)* http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10799/adobjxmp.htm
And this tutorial: *(Using Oracle User-Defined Types with .NET and Visual Studio)* http://www.oracle.com/technology/obe/hol08/dotnet/udt/udt_otn.htm
Now I have 3 Object Table: Stock, Customer and Purchase Order. With the tutorial it's OK to show the data of Stock and Customer Table [there is no nested table in], but I can't do this with table Purchase Order, the tutorial don't show how to work with Nested Table type [Missing or something ?]
When I try to display the data of table Purchase Order, I get the error:
typeName='LINEITEMLIST_NTABTYP'' is not specified or is invalid*
Follow the tutorial, I generate custom class for this UDT and get another error:
this.STOCK_REF = ((object)(Oracle.DataAccess.Types.OracleUdt.GetValue(con, pUdt, "STOCK_REF")));*
Argument Exception Unhandle: Object attribute is not mapped to a custom type member.*
Can You show me how to do this ? Show the data of the Nested Table in Visual Studio, do I have something wrong ??? Thanks and Best Regards.I think you need to go through the tutorial more carefully. I think you are missing steps.
You are using a REF. Are you creating an object table for the objects to be stored in? Are you dereferencing the REF? This is covered by the Oracle by Example tutorial.
http://www.oracle.com/technology/obe/hol08/dotnet/udt/udt_otn.htm#t11
When you receive the nested table, it will be inside a .NET class. You can create this class by using the Create Custom Class menu item on the nested table type in server explorer.
This class will contain a ToString method and a ToXML method.
The question is, where are you attempting to display the data from this nested table? In a grid?
Does it make sense to display a nested table inside one cell of a grid? No. You would need to construct a special UI that will show the
nested table. Maybe the user clicks on the cell on the grid, which opens a new grid that displays the data. Or maybe there is a second grid on the form that always shows the nested table for the row that the first grid currently has selected.
I realize I am not providing you the code... but it sounds like you need to design a more sohisticated UI than what the tutorial is using -- one that can handle displaying one additional table per row. -
Trying to UNION two views with nested tables
I am using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod, and my objective is to generate some XML. What I have been doing in the past, is to create a view, and then pass that view to the DBMS_XMLQuery routine. This gives me a CLOB that I pass along to the application. A typical object would be something like:
create or replace type XML_UGroup_Member_Type as object (
username varchar2(128),
group_key varchar2(128));
create or replace type XML_UGroup_Member_List
as table of XML_UGroup_Member_Type;
show errors
Create or replace type XML_UGroup_Type as object (
Group_Space varchar2(32),
group_key varchar2(128),
group_name varchar2(255),
members XML_UGroup_Member_List);
/This particular application will be doing stuff with group information. Pretty simply types - a group with a name and a few other keys, and a list of members. A sample view would be like:
create or replace view xml_department_ugroup_view of xml_ugroup_type
with object identifier ( group_key ) as
Select 'Department',
'Department:' || orgn_code,
'Department_' || orgn_name
cast ( multiset (
select Username, person_id,
'Department:' || effective_orgn
from directory_master dm, logins l
where effective_orgn = dd.orgn_code
and dm.person_id = l.owner)
as XML_UGroup_Member_List )
as members
from directory_departments dd
where dept_include = 'Y';
can select from this view, and I can pass it to the DBMS_XMLQUERY package and get a nice XML document. What I want to is essentially put several of these views together, like
Select * from XML_Department_Ugroup_View
Union
Select * from XML_Portfolio_Ugroup_View;But UNION does not work with nested tables:
ERROR at line 1: ORA-00932: inconsistent datatypes: expected - got SIMON.XML_UGROUP_MEMBER_LIST
What I was hoping to do, was to develop a set of sub views for each of the group "spaces", and then generate a view/object that includes all of the sub views, and be able to operate with that single object.
Thoughts on how to make this work, or on alternate approaches? I have considered calling XMLQuery on each of the sub views and concatenating the XML documents and returning that to the application, but I was hoping to find a more "unified" approach.I modified my approach a bit - I changed the base views to return an XMLType object, like:
create or replace view xml_portfolio_ugroup_xml
as
Select XMLElement("group",
xml_ugroup_type(
'Portfolio',
'Portfolio:' || coas_code || ':' || orgn_Code,
cast ( multiset (
select Username,
from directory_master dm, logins l
where ( effective_orgn, effective_coas ) in
where effective_orgn = dd.orgn_code
and dm.person_id = l.owner
as XML_UGroup_Member_List ))) as grp
from directory_departments dd
where dept_include = 'Y';and then I combined them with something like the following (I expect to adjust this as I learn more about the XML DB support)
create or replace view xml_ugroup_xml as
select xmlconcat(
(select xmlagg(grp) from xml_department_ugroup_xml),
(select xmlagg(grp) from xml_portfolio_ugroup_xml)
) as GROUPS
from dualand as I define more group branches, I can add them into the XMLConCat stanzas. I am still open to suggestions as to ways of doing this better or cleaner, but this at least gets the project moving forward again. -
Hi ,
Please assist as how can we do this thing
i have a nested table of object type
create or replace type a1 as object
a number,
b varchar2(30),
region varchar2(30)
create type a1_array s table of a1;
declare
v_a1 a1;
v_a1_array a1_array:=a1_array();
begin
v_a1= a1(1, '1' , 'AUS');
v_a1_array.EXTEND;
v_a1_array(1):=v_a1;
v_a1= a1(2, '2' , 'AUS');
v_a1_array.EXTEND;
v_a1_array(2):=v_a1;
v_a1= a1(3, '3' , 'NAM');
v_a1_array.EXTEND;
v_a1_array(3):=v_a1;
end;
Now, i have v_a1_array having 3 rows 2 with AUS region and one with NAM region.
Using SQL can i extract only 'AUS' rows and fetch in ARRAY OF TYPE v_a1_array (using Where clause and Table () functions )
Any help will be highly appreciated. Please assist. I have oracle 11g
ThanksHi,
GPU has already shown you how to do. I will just modify my original one:
SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 22 22:14:42 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> set serveroutput on
SQL>
SQL> DECLARE
2 v_a1 a1;
3 v_a1_array a1_array := a1_array ();
4 v_a1_array2 a1_array;
5 BEGIN
6 v_a1 := a1 (1, '1', 'AUS');
7 v_a1_array.EXTEND;
8 v_a1_array (1) := v_a1;
9 v_a1 := a1 (2, '2', 'AUS');
10 v_a1_array.EXTEND;
11 v_a1_array (2) := v_a1;
12 v_a1 := a1 (3, '3', 'NAM');
13 v_a1_array.EXTEND;
14 v_a1_array (3) := v_a1;
15
16 SELECT a1(a, b, region)
17 BULK COLLECT INTO v_a1_array2
18 FROM TABLE (v_a1_array)
19 WHERE region = 'AUS';
20
21 FOR c1 IN (SELECT *
22 FROM TABLE (v_a1_array2))
23 LOOP
24 DBMS_OUTPUT.put_line ('A='||c1.a||', B='||c1.b||', REGION='||c1.region);
25 END LOOP;
26 END;
27 /
A=1, B=1, REGION=AUS
A=2, B=2, REGION=AUS
PL/SQL procedure successfully completed.
If you consider your question answered, please mark this thread as answered.
Regards.
Alberto -
Using FOR .. LOOP counter in handling of PL/SQL procedures with nest. table
Hi all!
I'm learning PL/SQL on Steve Bobrovsky's book (specified below sample is from it) and I've a question.
In the procedure of specified below program used an integer variable currentElement to get reference to the row of nested table of %ROWTYPE datatype.
Meanwhile, the program itself uses a common FOR .. LOOP counter i.
DECLARE
TYPE partsTable IS TABLE OF parts%ROWTYPE;
tempParts partsTable := partsTable();
CURSOR selectedParts IS
SELECT * FROM parts ORDER BY id;
currentPart selectedParts%ROWTYPE;
currentElement INTEGER;
PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS
BEGIN
DBMS_OUTPUT.PUT_LINE(' ');
DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT);
currentElement := p_collection.FIRST;
FOR i IN 1 .. p_collection.COUNT
LOOP
DBMS_OUTPUT.PUT('Element #' || currentElement || ' is ');
IF tempParts(currentElement).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.');
ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(currentElement).id || ' DESCRIPTION: ' || tempParts(currentElement).description);
END IF;
currentElement := p_collection.NEXT(currentElement);
END LOOP;
END printParts;
BEGIN
FOR currentPart IN selectedParts
LOOP
tempParts.EXTEND(2);
tempParts(tempParts.LAST) := currentPart;
END LOOP;
printParts('Densely populated', tempParts);
FOR i IN 1 .. tempParts.COUNT
LOOP
IF tempParts(i).id is NULL THEN tempParts.DELETE(i);
END IF;
END LOOP;
FOR i IN 1 .. 50
LOOP
DBMS_OUTPUT.PUT('-');
END LOOP;
printParts('Sparsely populated', tempParts);
END;
/When I've substituted an INTEGER global variable with such FOR .. LOOP counter, an APEX have returned an error "ORA-01403: no data found".
DECLARE
TYPE partsTable IS TABLE OF parts%ROWTYPE;
tempParts partsTable := partsTable();
CURSOR selectedParts IS
SELECT * FROM parts ORDER BY id;
currentPart selectedParts%ROWTYPE;
PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS
BEGIN
DBMS_OUTPUT.PUT_LINE(' ');
DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT);
FOR i IN 1 .. p_collection.COUNT
LOOP
DBMS_OUTPUT.PUT('Element is ');
IF tempParts(i).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.');
ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(i).id || ' DESCRIPTION: ' || tempParts(i).description);
END IF;
END LOOP;
END printParts;
BEGIN
FOR currentPart IN selectedParts
LOOP
tempParts.EXTEND(2);
tempParts(tempParts.LAST) := currentPart;
END LOOP;
printParts('Densely populated', tempParts);
FOR i IN 1 .. tempParts.COUNT
LOOP
IF tempParts(i).id is NULL THEN tempParts.DELETE(i);
END IF;
END LOOP;
FOR i IN 1 .. 50
LOOP
DBMS_OUTPUT.PUT('-');
END LOOP;
printParts('Sparsely populated', tempParts);
END;
/When I've tried to handle this code in SQL*Plus, the following picture have appeared:
Densely populated elements: 10
Element is an empty element.
Element is ID: 1 DESCRIPTION: Fax Machine
Element is an empty element.
Element is ID: 2 DESCRIPTION: Copy Machine
Element is an empty element.
Element is ID: 3 DESCRIPTION: Laptop PC
Element is an empty element.
Element is ID: 4 DESCRIPTION: Desktop PC
Element is an empty element.
Element is ID: 5 DESCRIPTION: Scanner
Sparsely populated elements: 5
DECLARE
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 14
ORA-06512: at line 35What's wrong in code(or what I have not understood)? Help please!942736 wrote:
What's wrong in code(or what I have not understood)? Help please!First code. You have collection of 10 elements:
1 - null
2 - populated
3 - null
4 - populated
5 - null
6 - populated
7 - null
8 - populated
9 - null
10 - populated
Then you delete null elements and have 5 element collection
2 - populated
4 - populated
6 - populated
8 - populated
10 - populated
Now you execute:
printParts('Sparsely populated', tempParts);Inside procedure you execute:
currentElement := p_collection.FIRST;
This assingns currentElement value 2. Then procedure loops 5 times (collection element count is 5). Element 2 exists. Inside loop procedure executes:
currentElement := p_collection.NEXT(currentElement);
which assigns currentElement values 4,6,8,10 - all existing elements.
Now second code. Everything is OK until you delete null elements. Again we have:
2 - populated
4 - populated
6 - populated
8 - populated
10 - populated
Again you execute:
printParts('Sparsely populated', tempParts);Now procedure loops 5 times (i values are 1,2,3,4,5):
FOR i IN 1 .. p_collection.COUNT
Very first iteration assingns i value 1. And since collection has no element with substript 1 procedure raises no data found.
SY. -
Data pump import error with nested tables
So the problem is somewhat long :)
Actually the problems are two - why and how oracle are treating OO concept and why data pump doesn't work?
So scenario for the 1st one:
1) there is object type h1 and table of h1
2) there is unrelated object type row_text and table of row_text
3) there is object type h2 under h1 with attribute as table of row_text
4) there is table tab1 with column b with data type as table of h1. Of course column b is stored as nested table.
So how do you think - how many nested tables Oracle will create? The correct answer is 2. One explicitly defined and one hidden with system
generated name for the type h2 which is under type h1. So the question is WHY? Why if I create an instance of supertype Oracle tries to adapt
it for the subtype as well? Even more if I create another subtype h3 under h1 another hidden nested table appears.
This was the first part.
The second part is - if I do schema export and try to import it in another schema I got error saying that oracle failed to create storage table for
nested table column b. So the second question is - if Oracle has created such a mess with hidden nested tables how to import/export to another
schema?
Ok and here is test case to demonstrate problems above:
-- creating type h1 and table of it
SQL> create or replace type h1 as object (a number)
2 not final;
3 /
Type created.
SQL> create or replace type tbl_h1 as table of h1;
2 /
Type created.
-- creating type row_text and table of it
SQL> create or replace type row_text as object (
2 txt varchar2(100))
3 not final;
4 /
Type created.
SQL> create or replace type tbl_row_text as table of row_text;
2 /
Type created.
-- creating type h2 as subtype of h1
SQL> create or replace type h2 under h1 (some_texts tbl_row_text);
2 /
Type created.
SQL> create table tab1 (a number, b tbl_h1)
2 nested table b
3 store as tab1_nested;
Table created.
-- so we have 2 nested tables now
SQL> select table_name, parent_table_name, parent_table_column
2 from user_nested_tables;
TABLE_NAME PARENT_TABLE_NAME
PARENT_TABLE_COLUMN
SYSNTfsl/+pzu3+jgQAB/AQB27g== TAB1_NESTED
TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
TAB1_NESTED TAB1
B
-- another subtype of t1
SQL> create or replace type h3 under h1 (some_texts tbl_row_text);
2 /
Type created.
-- plus another nested table
SQL> select table_name, parent_table_name, parent_table_column
2 from user_nested_tables;
TABLE_NAME PARENT_TABLE_NAME
PARENT_TABLE_COLUMN
SYSNTfsl/+pzu3+jgQAB/AQB27g== TAB1_NESTED
TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
SYSNTfsl/+pz03+jgQAB/AQB27g== TAB1_NESTED
TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"
TAB1_NESTED TAB1
B
SQL> desc "SYSNTfsl/+pzu3+jgQAB/AQB27g=="
Name Null? Type
TXT VARCHAR2(100)OK let it be and now I'm trying to export and import in another schema:
[oracle@xxx]$ expdp gints/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints.log
Export: Release 11.2.0.1.0 - Production on Thu Feb 4 22:32:48 2010
<irrelevant rows skipped>
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "GINTS"."TAB1" 0 KB 0 rows
. . exported "GINTS"."SYSNTfsl/+pz03+jgQAB/AQB27g==" 0 KB 0 rows
. . exported "GINTS"."TAB1_NESTED" 0 KB 0 rows
. . exported "GINTS"."SYSNTfsl/+pzu3+jgQAB/AQB27g==" 0 KB 0 rows
Master table "GINTS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************And now import. In order to create types transformation of OIDs is applied and also remap_schema
Although it fails to create the table.
[oracle@xxx]$ impdp gints1/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
Import: Release 11.2.0.1.0 - Production on Thu Feb 4 22:41:48 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Release 11.2.0.1.0 - Production
Master table "GINTS1"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "GINTS1"."SYS_IMPORT_FULL_01": gints1/********@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:"GINTS1" already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Processing object type SCHEMA_EXPORT/TABLE/TABLE
ORA-39083: Object type TABLE:"GINTS1"."TAB1" failed to create with error:
ORA-02320: failure in creating storage table for nested table column B
ORA-00904: : invalid identifier
Failing sql is:
CREATE TABLE "GINTS1"."TAB1" ("A" NUMBER, "B" "GINTS1"."TBL_H1" ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
ORA-39083: Object type INDEX_STATISTICS failed to create with error:
ORA-01403: no data found
ORA-01403: no data found
Failing sql is:
DECLARE I_N VARCHAR2(60); I_O VARCHAR2(60); c DBMS_METADATA.T_VAR_COLL; df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN DELETE FROM "SYS"."IMPDP_STATS"; c(1) := DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"',1); DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n); INSERT INTO "
ORA-39083: Object type INDEX_STATISTICS failed to create with error:
ORA-01403: no data found
ORA-01403: no data found
Failing sql is:
DECLARE I_N VARCHAR2(60); I_O VARCHAR2(60); c DBMS_METADATA.T_VAR_COLL; df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN DELETE FROM "SYS"."IMPDP_STATS"; c(1) := DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"',1); DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n); INSERT INTO "
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "GINTS1"."SYS_IMPORT_FULL_01" completed with 4 error(s) at 22:41:52So any idea how to make export/import of such tables?
TIA
GintsTom Kyte has said it repeatedly ... I will repeat it here for you.
The fact that Oracle allows you to build object tables is not an indication that you should.
Store your data relationally and build object_views on top of them.
http://www.morganslibrary.org/reference/object_views.html
If you model properly, and store properly, you don' have any issues. -
Issues with Nested Tables and Adobe Designer
Hi,
I have some strange issues when I am trying to create a nested dynamic table with SAP DATA in Adobe Designer.
My Outer Table has article items and in this table I got a nested charges. For instance the table contains this data:
DATA
|->Article1
|--->charge111
|--->charge211
|
|->Article2
|--->charge122
|--->charge222
Now I am trying to display the data in a Adobe Designer table. But if I create a table with a row article and a repeating row charge all charges will be displayed under the first Article.
This is the result:
DATA
|->Article1
|--->charge111
|--->charge211
|--->charge122
|--->charge222
|
|->Article2
How can I solve this issue? I tried to select data binding on charges like article.DATA.charges.DATA[*] but this don't work.
Anyone an idea?Alex,
Is it print based form or interactvie form.
ABAP
If it is printbased form and if you are designing from SFP, you can use the following solution.
You have to create a nested table in the context as below.
say Table1-> Article ( fields: ARTICLENAME,....other fields) info Table2->cost info(fields:ARTICLENAME,Charge...,other fields).
The 2 tables should contains data as beow.
Table1 data.
1row->Article1 -.....other values.
2row->Article2 -.....other values.
3row->Article3 -.....other values.
Table2 data.
1row->Article1 -Charge11 .....other values.
2row->Article1 -Charge12 .....other values.
3row->Article1 -Charge13 .....other values.
4row->Article2 -Charge21 .....other values.
5row->Article2 -Charge22 .....other values.
6row->Article2 -Charge23 .....other values.
7row->Article3 -Charge31 .....other values.
8row->Article3 -Charge32 .....other values.
9row->Article3 -Charge33 .....other values.
In the context drag table2 into the table1 and define where clause on ARTICLENAME.
In the layout drag nested table in the body page and make alignments.
If your requirement is interactive, may be you can use the similar logic. -
Help needed with nested tables
I have two identical relations R and S defined as:
CREATE TYPE table_typ AS TABLE OF VARCHAR2(8);
CREATE TABLE R(
a INTEGER,
b table_type)
NESTED TABLE b STORE as b_1;
CREATE TABLE S(
a INTEGER,
b table_type)
NESTED TABLE b STORE as b_2;
Both have two tuples each:
INSERT INTO r VALUES (1, table_type('a','b'));
INSERT INTO r VALUES (2, table_type('d'));
INSERT INTO s VALUES (1, table_type('b','c'));
INSERT INTO s VALUES (3, table_type('e'));
Would it be possible to write a query that "unions" R and S so that nested tables in tuples (in R and S) that agree on the A attribute are merged together, while tuples that do not agree on A still appear in the result? That is, the result I am looking for is:
A B
1 TABLE_TYPE('a','b','c')
2 TABLE_TYPE('d')
3 TABLE_TYPE('e')
I've tried a simple union, but it does not work. Any help on this would be greatly appreciated.
Thanks,
LauraI don't have 10g, but the following is a 9i solution. I know there has to be a better way. About all I can say for the code below is that it works. I am only posting it because it is better than nothing, until somebody with 10g posts something better. I have included the stragg function by Tom Kyte.
scott@ORA92> -- test data:
scott@ORA92> CREATE OR REPLACE TYPE table_type AS TABLE OF VARCHAR2 (8);
2 /
Type created.
scott@ORA92> CREATE TABLE r(
2 a INTEGER,
3 b table_type)
4 NESTED TABLE b STORE as b_1
5 /
Table created.
scott@ORA92> CREATE TABLE s(
2 a INTEGER,
3 b table_type)
4 NESTED TABLE b STORE as b_2
5 /
Table created.
scott@ORA92> INSERT INTO r VALUES (1, table_type('a','b'));
1 row created.
scott@ORA92> INSERT INTO r VALUES (2, table_type('d'));
1 row created.
scott@ORA92> INSERT INTO s VALUES (1, table_type('b','c'));
1 row created.
scott@ORA92> INSERT INTO s VALUES (3, table_type('e'));
1 row created.
scott@ORA92> commit
2 /
Commit complete.
scott@ORA92> -- start of code from Tom Kyte:
scott@ORA92> create or replace type string_agg_type as object
2 (
3 total varchar2(4000),
4
5 static function
6 ODCIAggregateInitialize(sctx IN OUT string_agg_type )
7 return number,
8
9 member function
10 ODCIAggregateIterate(self IN OUT string_agg_type ,
11 value IN varchar2 )
12 return number,
13
14 member function
15 ODCIAggregateTerminate(self IN string_agg_type,
16 returnValue OUT varchar2,
17 flags IN number)
18 return number,
19
20 member function
21 ODCIAggregateMerge(self IN OUT string_agg_type,
22 ctx2 IN string_agg_type)
23 return number
24 );
25 /
Type created.
scott@ORA92> create or replace type body string_agg_type
2 is
3
4 static function ODCIAggregateInitialize(sctx IN OUT string_agg_type)
5 return number
6 is
7 begin
8 sctx := string_agg_type( null );
9 return ODCIConst.Success;
10 end;
11
12 member function ODCIAggregateIterate(self IN OUT string_agg_type,
13 value IN varchar2 )
14 return number
15 is
16 begin
17 self.total := self.total
18 || ','
19 || value;
20 return ODCIConst.Success;
21 end;
22
23 member function ODCIAggregateTerminate(self IN string_agg_type,
24 returnValue OUT varchar2,
25 flags IN number)
26 return number
27 is
28 begin
29 returnValue := ltrim(self.total,',');
30 return ODCIConst.Success;
31 end;
32
33 member function ODCIAggregateMerge(self IN OUT string_agg_type,
34 ctx2 IN string_agg_type)
35 return number
36 is
37 begin
38 self.total := self.total || ctx2.total;
39 return ODCIConst.Success;
40 end;
41
42
43 end;
44 /
Type body created.
scott@ORA92> CREATE or replace
2 FUNCTION stragg(input varchar2 )
3 RETURN varchar2
4 PARALLEL_ENABLE AGGREGATE USING string_agg_type;
5 /
Function created.
scott@ORA92> -- end of code from Tom Kyte
scott@ORA92> -- usage of above function:
scott@ORA92> COLUMN c FORMAT A15
scott@ORA92> SELECT a, stragg (column_value) AS c
2 FROM (SELECT t1.a, t1.column_value
3 FROM (SELECT r.a, c.column_value
4 FROM r, TABLE (r.b) c) t1,
5 (SELECT s.a, d.column_value
6 FROM s, TABLE (s.b) d) t2
7 WHERE t1.a = t2.a
8 UNION
9 SELECT t1.a, t2.column_value
10 FROM (SELECT r.a, c.column_value
11 FROM r, TABLE (r.b) c) t1,
12 (SELECT s.a, d.column_value
13 FROM s, TABLE (s.b) d) t2
14 WHERE t1.a = t2.a)
15 GROUP BY a
16 UNION ALL
17 SELECT a, stragg (column_value) AS c
18 FROM (SELECT t1.a, t1.column_value
19 FROM (SELECT r.a, c.column_value
20 FROM r, TABLE (r.b) c) t1,
21 (SELECT s.a, d.column_value
22 FROM s, TABLE (s.b) d) t2
23 WHERE t1.a = t2.a (+)
24 AND t2.a IS NULL
25 UNION
26 SELECT t2.a, t2.column_value
27 FROM (SELECT r.a, c.column_value
28 FROM r, TABLE (r.b) c) t1,
29 (SELECT s.a, d.column_value
30 FROM s, TABLE (s.b) d) t2
31 WHERE t1.a (+) = t2.a
32 AND t1.a IS NULL)
33 GROUP BY a
34 /
A C
1 a,b,c
2 d
3 e -
I am dealing with a nested table (I simplified the case
for purpose of posting):
CREATE TABLE boris_main_tab (
IND_SSN VARCHAR2(9) PRIMARY KEY,
children B_CHILDREN_TBL,
) nested table children stored as....
where B_CHILDREN_TBL is defined like this:
create or replace type b_children_type as object (
child_ssn VARCHAR2(9),
child_first_name VARCHAR2(20),
child_last_name VARCHAR2(20),
child_dob date
create or replace type b_children_tbl as table of b_children_type;
if I want to display person's ssn along with his/her children information I do like this:
SELECT m.ind_ssn, c.child_ssn, c.child_first_name
FROM boris_main_tab m,
TABLE(m.children) c
This is a statement I can find everywhere. But there is a caveat here, they
forgot to mention. This is really an inner join, so I don't get childless
people. Can you, guys, help me with the outer join syntax?
I mean, of course, I found the obvious solution to make this inner join
into a view and then join it with the boris_main_tab again this time using the
regular outer join syntax. But it seems to me there has to be something simplier than that.
But I can't find it. It really hurting me, since I have a few nested table
columsn and people want to see the records where I need to mention a few of
them, sort of like
from boris_main_tab m, TABLE(m.children) c, TABLE(m.spouses) s
where c.child_last_name <> m.spouse.last_name
in cases like this the fact that EACH of these joins is inner join really
hurts the logic.
Respectfully,
BorisHi Borris,
Found the following in the Oracle Documentation under: Oracle8i Application Developer's Guide - Object-Relational Features Release 2 (8.1.6)
2 Managing Oracle Objects / Using Collections / Collection Unnesting
URL: http://www.znow.com/sales/oracle/appdev.816/a76976/adobjmng.htm#1002885
Oracle8i also supports the following syntax to produce outer-join results:
SELECT d.*, e.* FROM depts d, TABLE(d.emps)(+) e;
The (+) indicates that the dependent join between DEPTS and D.EMPS should be NULL-augmented. That is, there > will be rows of DEPTS in the output for which D.EMPS is NULL or empty, with NULL values for columns
corresponding to D.EMPS. -
Urgent Help Please, Error with Nested Table
Hello All,
I'm trying to create data mining models based on some medical data. I have combined two tables (Patients) and (tumors) into one table (cancer_patients). In the (cancer_patients) table there is one column (tumors) as nested table column. So I got the following error (ORA-22913) about the nested table. I need an advice about how to fix this error in ODM please
This is the code of the tables
CREATE TABLE "DSS2_MINING"."PATIENTS"
( "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE,
"REGISTRY_ID" NUMBER(10,0),
"RACE" VARCHAR2(2 BYTE),
"***" VARCHAR2(1 BYTE),
"BIRTHDATE_YEAR" NUMBER(4,0),
"NUMBER_OF_PRIMARIES" NUMBER(1,0),
"VITAL_STATUS_RECORD" VARCHAR2(1 BYTE),
"CAUSE_OF_DEATH" VARCHAR2(5 BYTE),
"SURVIVAL_TIME" VARCHAR2(4 BYTE),
"SURVIVAL_TIME_FINAL" NUMBER,
"SURVIVAL_VARIABLE" VARCHAR2(1 BYTE),
CONSTRAINT "PATIENTS_PK" PRIMARY KEY ("PATIENT_ID");
CREATE TABLE "DSS2_MINING"."TUMORS"
( "TUMOR_ID" NUMBER NOT NULL ENABLE,
"PATIENT_ID" VARCHAR2(10 BYTE), -- FK
"SEER_RECORD_NUMBER" NUMBER, -- This column contain a sequance number of the records for each patients
"MARITAL_STATUS" VARCHAR2(1 BYTE),
"AGE" NUMBER,
"DATE_OF_DIAGNOSIS" DATE,
"HISTOLOGY_GROUP" VARCHAR2(2 BYTE),
"BEHAVIOR" VARCHAR2(1 BYTE),
"GRADE" VARCHAR2(1 BYTE),
"DERIVED_AJCC_STAGE_GROUP" VARCHAR2(2 BYTE),
"STAGE_OF_CANCER" VARCHAR2(2 BYTE),
"RADIATION" VARCHAR2(1 BYTE),
"CS_SCHEMA" VARCHAR2(2 BYTE),
"FIRST_PRIMARY_IND" VARCHAR2(1 BYTE),
"TUMOR_SIZE" NUMBER(4,1),
"TUMOR_EXTENSION" VARCHAR2(2 BYTE),
"LYMPH_NODES" VARCHAR2(1 BYTE),
"NODES_POSITIVE" NUMBER,
"ESTROGEN" VARCHAR2(3 BYTE),
"PROGESTERONE" VARCHAR2(3 BYTE),
"SURGERY" VARCHAR2(2 BYTE),
CONSTRAINT "TUMORS_PK" PRIMARY KEY ("TUMOR_ID");
create or replace type tumor_object AS
object(
tumor_id VARCHAR2(1),
marital_status VARCHAR2(1),
age NUMBER(3),
date_of_diagnosis DATE,
cs_schema VARCHAR2(2),
histology_group VARCHAR2(2),
behavior VARCHAR2(1),
grade VARCHAR2(1),
first_primary_ind VARCHAR2(1),
tumor_size NUMBER(4, 1),
tumor_extension VARCHAR2(2),
lymph_nodes VARCHAR2(1),
nodes_positive NUMBER(4),
surgery VARCHAR2(2),
radiation VARCHAR2(1)
create or replace type tumor_table as table of tumor_object;
CREATE TABLE "DSS2_MINING"."CANCER_PATIENTS"
( "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE,
"RACE" VARCHAR2(2 BYTE),
"***" VARCHAR2(1 BYTE),
"NUMBER_OF_PRIMARIES" NUMBER(1,0),
"TUMORS" "DSS2_MINING"."TUMOR_TABLE" ,
"VITAL_STATUS_RECORD" VARCHAR2(1 BYTE),
"CAUSE_OF_DEATH" VARCHAR2(5 BYTE),
"SURVIVAL_TIME_FINAL" NUMBER,
"SURVIVAL_VARIABLE" VARCHAR2(1 BYTE),
CONSTRAINT "CANCER_PATIENTS_PK" PRIMARY KEY ("PATIENT_ID")
NESTED TABLE "TUMORS" STORE AS "TUMORS_STOR_TABLE"Then, I have transferred the data using
INSERT
INTO CANCER_PATIENTS
SELECT PATIENT_ID,
RACE,
NUMBER_OF_PRIMARIES,
SELECT CAST(
COLLECT(
TUMOR_OBJECT(
TUMOR_ID,
MARITAL_STATUS,
AGE,
DATE_OF_DIAGNOSIS,
CS_SCHEMA,
HISTOLOGY_GROUP,
BEHAVIOR,
GRADE,
FIRST_PRIMARY_IND,
TUMOR_SIZE,
TUMOR_EXTENSION,
LYMPH_NODES,
NODES_POSITIVE,
SURGERY ,
RADIATION
AS TUMOR_TABLE
FROM "TUMORS" T
WHERE T.PATIENT_ID = P.PATIENT_ID
VITAL_STATUS_RECORD,
CAUSE_OF_DEATH,
SURVIVAL_TIME_FINAL,
SURVIVAL_VARIABLE
FROM PATIENTS PThanks
A.L
Edited by: user9003901 on Nov 30, 2010 12:23 AMHi
i was using AWM since 9i just because it creates OLAP metadata with a new API called CWM2, and Oracle Enterprise Manager was using a propietary API .
With AWM 10.1.0.4 building your OLAP metadata is very simple, you can define your Dimensions, cubes, measures and even you can load your data from your source system.
You can refer to the Oracle® OLAP Application Developer's Guide where you can find more information on this tool.
And relative to your error i will recommend that you build on a dimension-by-dimension basis and try to validate your OLAP Metadata.
Regards
Maybe you are looking for
-
Split project? to make the file smaller?
Hi We have just started to use Captivate and we want to use voice and video caption But we are a bit affraid that the file size will be a problem for or network /Lines Will it be a problem do you think? And if it will - how can we split them so that
-
GR without PO (501 Mvmt Type)
Dear All, I request your help to resolve following issue. customer is doing goods receipt without any PO using 501 Mvmt Type. When invoicing using MIRO, what ref. document we need to consider? As there is no preceding document how to post invoice usi
-
Transfer of forecast from SNP to ECC
We are using transfer profile to transfer forecast (9ADFCST) from SNP to ECC. We find that the original forecast is not transferred, but only the unconsumed (Original fcst - sales) forecast is transferred. Is there a way to transfer the original for
-
hello forumers. its been a while since ive used flash,and im struggeling with a command id normaly do within seconds. im trying to add a stop action on one of my layers,i know the action script is stop ( ) ; but i cant recall how to add it only to th
-
RAM Croaking - Help me spend $!
Ha! Thought that would get the collective attention! My PC3200 TCCD PQI Turbo Platinums are getting ready to bite the dust. After quite a few not so great OC attempts & generally unstable performance, I got my thumbs out & ran 'em through MemTest and