Nested tables recursive SQL
Hello, I am trying to figure out why I get the following error message
ORA-00604: error occurred at recursive SQL level 1
ORA-22914: DROP of nested tables not supported
I am using the TOAD tool to create tables using CTAS and I have managed to create several tables using the same SQL that is failing now with the only difference being a portion of the WHERE clause.
Any help will be very much appreciated
ORA-22914: DROP of nested tables not supported
Cause: An attempt was made to DROP a nested table.
Action: Nested tables cannot be explicitly dropped. nested tables can
only be dropped by dropping their containing parent table.
Similar Messages
-
DML on nested tables using SQL
Hello. Can anyone tell me what's wrong??
SQL> create type mytype as table of varchar2(20);
Type created
real: 78
SQL> declare
2 c mytype;
3 begin
4 select table_name bulk collect into c from user_tables;
5 delete from table(cast(c as mytype));
6 end;
7 /
declare
ERROR at line 1:
ORA-06550: line 5, column 13:
PL/SQL: ORA-00903: invalid table name
ORA-06550: line 5, column 1:
PL/SQL: SQL Statement ignored
real: 31we cannot use variables in regular SQL. It has to be
dynamic, viz
begin
for r in ( select table_name from user_tables )
loop
execute immediate ' delete from '||r.table_name;
d loop;
end;
/Cheers, APCyes, but user_tables was only a example. I want to load some data into nested table using BULK COLLECT and then perform some operation on this pl/sql table.
For example:
SELECT col BULK COLLECT INTO c FROM a_table;
SELECT * BULK COLLECT INTO d FROM TABLE(CAST (c AS sql_type));
--After that c and d contain the same data
--but for example
UPDATE TABLE(CAST(c AS sql_type)) Set c.col=...;
generates invalid table name.
Why SELECT INTO works, and UPDATE doesn't (all of this was in PL/SQL context, not SQL). -
Loading Nested table with SQL Loader
We have 15 nested tables in an table. Need help in creating a contol file. Tried with the syntax of object collection and didn't work. Can any none share the syntax please.
-- Thanks,
Phani AdusumilliThanks Srini and Zoltan.
I am able to figure out, here is the example with one nested table.
CREATE OR REPLACE TYPE feature_count_type AS OBJECT (
feature_type VARCHAR2(60),
occurs INTEGER
CREATE OR REPLACE TYPE feature_count_ntbl
AS TABLE OF feature_count_type;
CREATE TABLE PHANI_ADUSUMILLI(
state VARCHAR2(2),
county VARCHAR2(20),
feature_count feature_count_ntbl
) NESTED TABLE feature_count
STORE AS nested_feature_count_table;
LOAD DATA
INFILE *
TRUNCATE INTO TABLE PHANI_ADUSUMILLI
county CHAR TERMINATED BY ',' ENCLOSED BY '"',
element_count FILLER INTEGER EXTERNAL TERMINATED BY ',',
feature_count NESTED TABLE COUNT(element_count)
dummy_name COLUMN OBJECT
feature_type CHAR TERMINATED BY ',',
occurs INTEGER EXTERNAL TERMINATED BY ','
state CHAR TERMINATED BY ','
BEGINDATA
"Alger",5,lake,213,stream,88,falls,18,bay,11,island,5,MI
"Marquette",6,lake,293,stream,145,falls,5,bay,8,island,5,summit,23,MI
"Keweenaw",3,lake,86,falls,1,summit,16,MI -
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. -
Hi all,
i have the following code:
DROP TYPE unit_function FORCE
DROP TYPE unit_moving_point FORCE
DROP TYPE moving_point_tab FORCE
DROP TYPE moving_point FORCE
DROP TABLE moving_object_ref
DROP TABLE moving_point_ref
CREATE OR REPLACE TYPE unit_function AS OBJECT
xi NUMBER,
yi NUMBER
CREATE OR REPLACE TYPE unit_moving_point AS OBJECT
p tau_tll.d_period_sec,
m unit_function
CREATE OR REPLACE TYPE moving_point_tab AS TABLE OF unit_moving_point;
CREATE OR REPLACE TYPE moving_point AS OBJECT
u_tab moving_point_tab
CREATE TABLE moving_point_ref OF moving_point NESTED TABLE u_tab STORE AS m_u_tab
When i execute this for the first time the drop commands fail, as expected and the types/tables are successfully created. But if i try to run again the same code i get this error:
ORA-00604: error occurred at recursive SQL level 1 ORA-04063: table "HERMESL.MOVING_POINT_REF" has errors
I have tried to first drop the tables and after the types but then I get this error:
ORA-00604: error occurred at recursive SQL level 1 ORA-22914: DROP of nested tables not supported
this error occurs when the "DROP TYPE unit_function FORCE" and "DROP TYPE unit_moving_point FORCE" commands is to be executed...
Can anyone help me?
Thanks...Works on 10.1.0.3.
What is your exact version?
SQL> DROP TYPE unit_function FORCE
2 /
DROP TYPE unit_function FORCE
ERROR at line 1:
ORA-04043: object UNIT_FUNCTION does not exist
SQL> DROP TYPE unit_moving_point FORCE
2 /
DROP TYPE unit_moving_point FORCE
ERROR at line 1:
ORA-04043: object UNIT_MOVING_POINT does not exist
SQL> DROP TYPE moving_point_tab FORCE
2 /
DROP TYPE moving_point_tab FORCE
ERROR at line 1:
ORA-04043: object MOVING_POINT_TAB does not exist
SQL> DROP TYPE moving_point FORCE
2 /
DROP TYPE moving_point FORCE
ERROR at line 1:
ORA-04043: object MOVING_POINT does not exist
SQL> DROP TABLE moving_object_ref
2 /
DROP TABLE moving_object_ref
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> DROP TABLE moving_point_ref
2 /
DROP TABLE moving_point_ref
ERROR at line 1:
ORA-00942: table or view does not exist
SQL>
SQL> CREATE OR REPLACE TYPE unit_function AS OBJECT
2 (
3 xi NUMBER,
4 yi NUMBER
5 );
6 /
Type created.
SQL> CREATE OR REPLACE TYPE unit_moving_point AS OBJECT
2 (
3 m unit_function
4 );
5 /
Type created.
SQL> CREATE OR REPLACE TYPE moving_point_tab AS TABLE OF unit_moving_point;
2 /
Type created.
SQL> CREATE OR REPLACE TYPE moving_point AS OBJECT
2 (
3 u_tab moving_point_tab
4 );
5 /
Type created.
SQL> CREATE TABLE moving_point_ref OF moving_point
2 NESTED TABLE u_tab
3 STORE AS m_u_tab
4 /
Table created.
SQL> DROP TYPE unit_function FORCE
2 /
Type dropped.
SQL> DROP TYPE unit_moving_point FORCE
2 /
Type dropped.
SQL> DROP TYPE moving_point_tab FORCE
2 /
Type dropped.
SQL> DROP TYPE moving_point FORCE
2 /
Type dropped.
SQL> DROP TABLE moving_object_ref
2 /
DROP TABLE moving_object_ref
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> DROP TABLE moving_point_ref
2 /
Table dropped.
SQL>
SQL> CREATE OR REPLACE TYPE unit_function AS OBJECT
2 (
3 xi NUMBER,
4 yi NUMBER
5 );
6 /
Type created.
SQL> CREATE OR REPLACE TYPE unit_moving_point AS OBJECT
2 (
3 m unit_function
4 );
5 /
Type created.
SQL> CREATE OR REPLACE TYPE moving_point_tab AS TABLE OF unit_moving_point;
2 /
Type created.
SQL> CREATE OR REPLACE TYPE moving_point AS OBJECT
2 (
3 u_tab moving_point_tab
4 );
5 /
Type created.
SQL> CREATE TABLE moving_point_ref OF moving_point
2 NESTED TABLE u_tab
3 STORE AS m_u_tab
4 /
Table created.
SQL> disconnect
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options -
Sql*loader and nested tables
I'm having trouble loading a nested table via sqlldr in Oracle 10g and was hoping someone could point me in the right direction. I keep getting the following error:
SQL*Loader-403: Referenced column not present in table mynamespace.mytable
Here's an overview of my type and table definitions:
create type mynamespace.myinfo as object
i_name varchar2(64),
i_desc varchar2(255)
create TYPE mynamespace.myinfotbl as TABLE of mynamespace.myinfo;
create table mynamespace.mytable
Info mynamespace.myinfotbl,
note varchar2(255)
NESTED TABLE Info STORE AS mytable_nested_tab;
My control file looks like this:
load data
infile 'mydatafile.csv'
insert into table mynamespace.mytable
fields terminated by ',' optionally enclosed by '"'
TRAILING NULLCOLS
Info nested table count(6)
Info column object
i_name char(64),
i_desc char(255)
note
Example mydatafile.csv would be something like:
lvl1,des1,lvl2,des2,lvl3,des3,lvl4,des4,lvl5,des5,lvl6,des6,a test data set
I can't figure out why sqlldr keeps rejecting this control file. I'm using 'direct=false' in my .par file.
Any hints?I just noticed that my email is wrong. If you can help, plese send email to [email protected]
thanks. -
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. -
SQL Loader, nested tables and default values
Is there a way to specify a default value for a nested table entry when SQL*Loader encounters a 'null' value?
I want to avoid this:
Record 5: Rejected - Error on table LEVEL_DESC, column LEVELS.
NULL nested table element is not allowedUse the NULLIF parameter in your control file for the nested table objects.
e.g
LOAD DATA
INFILE 'level_data.dat'
INTO TABLE LEVEL
(LEVEL_ID POSITION (01:05) CHAR
LEVEL_NAME POSITION (07:20)
LEVEL_DESC COLUMN OBJECT
(LEVELS POSITION (22:25) CHAR NULLIF LEVEL_DESC.LEVELS=BLNAKS,
... )) -
SQL Loader Constraints with Column Objects and Nested Tables
I am working on loading a Table that (god forbid) contains columns, column objects, and nested tables (which contains several depth of column objects). My question is does SQL Loader have a hidding undocumented feature where it states how the column objects must be grouped in refereneced to the nested tables within the loader file? I can load the various column objects, and nested tables fine right now, however, I am loading them all in strange and insane order. Can anyone answer this question? Thanks.
PeterI just noticed that my email is wrong. If you can help, plese send email to [email protected]
thanks. -
PL/SQL add procedure with nested table
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
SGWhat I think I need is something of the sort
Create or replace procedure add_order (ordno in Varchar2, Cust_name in varchar2, add1 in varchar2,
add2 in varchar2, add3 in Varchar2, Addtown in varchar2, Pstcde in Varchar2, addcountry in varchar2, ord_date in date)
AS
Begin
DBMS_OUTPUT.PUT_LINE ('Insert attempted');
Insert into Orders (Order_no,Customer_name, AddressLine1, AddressLine2, AddressLine3,
Town, Postcode, Country, Order_Date)
values (ordno, Cust_name,add1, add2, add3, Addtown, Pstcde, addcountry,
ord_date);
Commit;
DBMS_OUTPUT.PUT_LINE ('Insert successful');
Exception
When Others then DBMS_OUTPUT.PUT_LINE ('ERROR');
DBMS_OUTPUT.PUT_LINE ('Procedure failed');
End;
SG -
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. -
Jdeveloper pl/sql webservices with Nested Tables
Hello
I am using JDeveloper 10.1.3.1.0,I have created pl/sql webservice using the nested tables. This will insert the object data into database tables.after deplying the webservice into external oc4j, when I test the webservice locally with url: http://localmachine:8888/PL_SQL_WS-Nest_Obj_Webservice-context-root/ObjWebserviceSoapHttpPort
The above web-services working and I am able to insert into the database tables.
Same when I want to access through the application server, I have changed the wsdl file soap address as
<soap:address location="http://10.91.20.7:8888/PL_SQL_WS-Nest_Obj_Webservice-context-root/ObjWebserviceSoapHttpPort"/>
When I access this url, I am able to give the input data
http://10.91.20.7:8888/PL_SQL_WS-Nest_Obj_Webservice-context-root/ObjWebserviceSoapHttpPort
but the out from the web-service is:
<env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<env:Fault
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>env:Server</faultcode>
<faultstring>Error creating target: DBConnImpMftest.ObjWebserviceUser</faultstring>
<faultactor/>
</env:Fault>
</env:Body>
</env:Envelope>
Could any one help to solve the above issue?
Kind regards
Malathitry that !
select a.*, case
when a.item_type = 1 then b.inv_date
when a.item_type = 3 then c.deb_date
end as item_date
from receipt_item a
left join invoice b on a.item_id = b.invvi_id and a.item_type = 1
left join Debit c on a.item_id = c.deb_id and a.item_type = 3 -
Drop Table :ORA-00604: error occurred at recursive SQL level 1
Hi,
When I am trying to drop a table, getting the following error:
SQL> drop table drp_test;
drop table drp_test
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01422: exact fetch returns more than requested number of rows
This is applicable even when I am trying to drop a table as sys user. I am not able to drop any table within this database. Previously I was able to carry this operation successfully.
Database Version: 10.2.0.1.0
OS: Linux
Thanks in advance for your valuable time.
Regards,
JoyHi Anurag,
I was unable to access net and hence is the delay in reply. Kindly suggest me regarding the level of trace to be generated.
Regards,
Joy -
Simple question aboout PL/SQL nested tables
Hello, my question is about nested tables. Suppose I have a nested table:
TYPE int_array IS TABLE OF INT;
v_int_array int_array;
Is there a built in function to allow me to search v_int_array for a specific integer value?
GeorgeUse MEMBER OF operator:
declare
TYPE int_array IS TABLE OF INT;
v_int_array int_array := int_array(1,2,3,4,5);
begin
if 1 member of v_int_array
then
dbms_output.put_line('Found it!');
end if;
end;
Found it!
PL/SQL procedure successfully completed.
SQL> SY.
Maybe you are looking for
-
I can no longer download PDF statements from my credit card site.
I was trying to download a PDF statement from Chase credit card site, like I have done many times in the past, and it will not do a download. It opens the new window with nothing, and the downloads page has nothing on it. Can I go back to the previou
-
Adding threshold values in an existing query
Hi All, I have to update an existing query. The original query gives me the value of Debtors to sales ratio for each division (DTR value). Now, I want that for each division, there be a threshold value which should be compared with the debtor's value
-
Migrating data from ObjectStore
I have a project going on which needs migration of data (GIS in SmallWorld and linked dynamic database in ObjectStore) to Oracle spatial 8i. May I know if it is feasible? Will it be one-to-one mapping? Can the data be maintained in OODB structure or
-
Apple tv won't recognize iTunes account information
apple tv will allow us to enter pics in photostream. But we cannot log in to computers iTunes. We have sharing on. We have confirmed id and password in the iTunes account.
-
Right alignment with SpringLayout
I've just started playing with SpringLayout. I've been using mostly BoxLayout up to now but I thought it was time I gave an alternative a go. BoxLayout has it's own erratic sizing problems. Anyway I'm trying to generate a sub panel like: Title (cente