Oracle packages - nested table cursor - 11g upgrade testing

I have a package call Crisis_Contacts. This package has a function(generate_file) in it that has a create cusor statement which calls on another function(split) in another package called NCF_UTL. In testing our code for a 11g upgrade the cursor statement calling on the split function is throwing a Error: ORA-00600: internal error code, arguments: [4814], [5], [0], [0], [], [], [], [], [], [], [], [] when compiling the package, which it was not doing prior to upgrade. Can you suggest a possible workaround or mod to this code to stop the error from occuring.
Basically, this code is reading html files and spliting them into section and loading them into the cursor. Then the cursor is read to write them to a table. Then it reads the table and transmits the lines of html to another location.
CREATE OR REPLACE package body ACADMGR.crisis_contacts as
function generate_file( file_type in varchar2,
person_pidm in integer := null,
person_id in varchar2 := null,
dry_run in varchar2 := 'N',
pidm_filter in varchar2 := null,
include_placeholders in varchar2 := 'N',
comments in varchar2 := null ) return integer is
cursor typeDef is
select * from crisis_contact_file_type ccft
where ccft.file_type = generate_file.file_type;
file_type_def typeDef%rowtype;
cursor fieldDef is
select * from crisis_contact_file_field ccff
where ccff.file_type = generate_file.file_type
order by seq asc;
type r_typ is ref cursor;
r r_typ;
datasel varchar2(32767) := '';
r_pidm integer;
pers_pidm integer := person_pidm;
prev_pidm integer;
r_tag varchar2(255);
r_val varchar2(4000);
type field_list is table of varchar2(256);
type field_index is table of integer index by varchar2(256);
type val_list is table of varchar2(4000);
type req_tbl is table of boolean index by varchar2(256);
req_fields field_list := field_list();
all_req_seen boolean;
fields field_list := field_list();
vals val_list := val_list();
field_idx field_index;
out_id integer;
out_line integer := 0;
buf varchar2(4000);
saved_out_line integer := 0;
xml_section_lf_delims ncf_utl.split_tbl := ncf_utl.split_tbl( ncf_utl.crlf, chr(13), chr(10) );
cursor splitcur( txt in varchar2 ) is
select column_value line from table(ncf_utl.split( txt, xml_section_lf_delims ));
cursor get_output is
select text from crisis_contact_file_line
where output_id = out_id
order by line_no asc;
log_time date := sysdate;
log_seq integer := 1;
procedure outp( txt in varchar2 ) is
begin
--dbms_output.put_line( txt );
insert into crisis_contact_file_line
( output_id, line_no, text )
values
( out_id, out_line, txt );
out_line := out_line + 1;
end;
procedure split_outp( txt in varchar2 ) is
begin
if txt is not null then
for r in splitCur( txt ) loop
outp( r.line );
end loop;
end if;
end;
begin
open typeDef;
fetch typeDef into file_type_def;
close typeDef;
if pers_pidm is null and person_id is not null then
select distinct(spriden_pidm) into pers_pidm from spriden
where spriden_id = person_id;
end if;
insert into crisis_contact_file_out ( file_type, comments ) values ( file_type, comments )
returning output_id into out_id;
datasel := gen_outfile_sql( file_type, pers_pidm, pidm_filter, include_placeholders );
if dry_run = 'Y' then
ncf_utl.output_text( datasel );
else
split_outp( file_type_def.preamble );
buf := '';
for f in fieldDef loop
fields.extend;
fields(fields.last) := f.alias;
field_idx(f.output_field) := fields.last;
vals.extend();
if f.mandatory = 'Y' then
req_fields.extend;
req_fields(req_fields.last) := f.output_field;
end if;
if file_type_def.file_mode = 'DELIM' and file_type_def.print_heading = 'Y' then
buf := buf || case when fieldDef%rowcount > 1 then nvl(file_type_def.delimiter,',') else '' end ||
nvl(file_type_def.quote,'') || nvl(f.alias,f.output_field) || nvl(file_type_def.quote,'');
end if;
end loop;
if length(buf) > 0 then
outp(buf);
end if;
--outp( '<?xml version="1.0" encoding="UTF-8"?>' );
--outp( '<recipients>' );
open r for datasel;
loop
fetch r into r_pidm, r_tag, r_val;
exit when r%notfound;
if prev_pidm is null or prev_pidm != r_pidm then
if prev_pidm is not null then
split_outp( file_type_def.record_end );
all_req_seen := true;
--check and reset 'seen' flags for required fields
for i in 1..req_fields.count loop
if vals(field_idx(req_fields(i))) is null then
all_req_seen := false;
end if;
end loop;
--if not all_req_seen then
-- rollback to USER_START;
-- out_line := saved_out_line;
--end if;
if all_req_seen then
buf := '';
for i in 1..fields.count loop
if file_type_def.file_mode = 'XML' then
outp( ' <' || fields(i) || '>' || vals(i) || '</' || fields(i) || '>' );
elsif file_type_def.file_mode = 'DELIM' then
buf := buf || case when i > 1 then nvl(file_type_def.delimiter,',') else '' end ||
nvl(file_type_def.quote,'') || vals(i) || nvl(file_type_def.quote,'');
end if;
end loop;
if file_type_def.file_mode = 'DELIM' then
outp(buf);
end if;
end if;
end if;
--savepoint USER_START;
--saved_out_line := out_line;
if r_tag != 'endofdata' then
split_outp( file_type_def.record_start );
end if;
for i in 1..fields.count loop
vals(i) := null;
end loop;
end if;
prev_pidm := r_pidm;
if field_idx.exists(r_tag) then
if r_val is not null then
vals(field_idx(r_tag)) := r_val;
end if;
end if;
end loop;
if pers_pidm is not null then
split_outp( file_type_def.record_end );
end if;
split_outp( file_type_def.postamble );
--for o in get_output loop
-- dbms_output.put_line( o.text );
--end loop;
end if;
return out_id;
end generate_file;
procedure gen_and_transmit( file_type in varchar2,
username in varchar2, pass in varchar2,
pidm_filter in varchar2 := null,
include_placeholders in varchar2 := 'N',
comments in varchar2 := null,
url_base in varchar2 := null, url_path in varchar2 := null,
ssl_wallet_path in varchar2 := null, ssl_wallet_pass in varchar2 := null ) is
out_id integer;
begin
out_id := generate_file( file_type, pidm_filter => pidm_filter,
include_placeholders => include_placeholders,
comments => comments );
--transmit_file( out_id, username, pass,
transmit_file( out_id, 'mhaywood', '------------',
url_base => url_base, url_path => url_path,
ssl_wallet_path => ssl_wallet_path, ssl_wallet_pass => ssl_wallet_pass );
end gen_and_transmit;
begin
UTL_HTTP.set_persistent_conn_support( true, 10 );
end;
create or replace
PACKAGE BODY NCF_UTL IS
PROCEDURE OUTPUT_TEXT( BUFFER IN VARCHAR2, LINE_LEN IN INTEGER := 80 ) IS
TYPE CHRLIST IS TABLE OF VARCHAR2(1);
cr VARCHAR2(1) := CHR(13);
     lf VARCHAR2(1) := CHR(10);
     tab VARCHAR2(1) := CHR(9);
     whitespace CHRLIST := CHRLIST( ' ', tab );
     pos INTEGER := 1;
     len INTEGER;
     brk INTEGER;
     curbrk INTEGER;
     lnbrk INTEGER;
     whtbrk INTEGER;
     i INTEGER;
BEGIN
len := LENGTH(BUFFER);
     WHILE pos <= len
     LOOP
     WHILE SUBSTR( BUFFER, pos, 1 ) IN ( cr, lf )
     LOOP
     pos := pos + 1;
     END LOOP;
     --find the next newline type char, or pos+250 if one isn't found
lnbrk := LEAST( NVL(NULLIF(INSTR( BUFFER, cr, pos ),0),pos+250),
                         NVL(NULLIF(INSTR( BUFFER, lf, pos ),0),pos+250) );
     --after the loop:
     -- whtbrk should be the last whitespace char before LINE_LEN + pos
     -- (or == pos, if none found)
     -- curbrk should be == 0 or the 1st whitespace after LINE_LEN + pos
     whtbrk := pos;
     curbrk := pos;
     FOR i IN 1..whitespace.COUNT
     LOOP
     LOOP
     curbrk := INSTR( BUFFER, whitespace(i), whtbrk + 1 );
          IF curbrk <= pos + LINE_LEN AND curbrk >= whtbrk THEN
          whtbrk := curbrk;
          END IF;
          EXIT WHEN curbrk > pos + LINE_LEN OR curbrk = 0;
          END LOOP;
          EXIT WHEN curbrk > pos + LINE_LEN;
     END LOOP;
     brk := LEAST( len + 1, lnbrk, NVL( NULLIF( whtbrk, pos ), pos + 250 ),
                    NVL( NULLIF( curbrk, 0 ), pos + 250 ), pos + 250 );
     dbms_output.put_line( SUBSTR( BUFFER, pos, brk - pos ) );
     pos := brk;
     END LOOP;
END;
function split( str in varchar2, d0 in varchar2, d1 in varchar2 := null,
d2 in varchar2 := null, d3 in varchar2 := null,
d4 in varchar2 := null, d5 in varchar2 := null,
d6 in varchar2 := null, d7 in varchar2 := null,
d8 in varchar2 := null, d9 in varchar2 := null )
return split_tbl pipelined is
pos integer := 1;
curidx integer;
idx integer;
delims split_tbl;
idx_delim varchar2(32767);
len integer := length( str );
begin
if d0 is null then
--split on whitespace
delims := split_tbl( ' ', chr(9), chr(10), chr(13) );
else
delims := split_tbl( d0, d1, d2, d3, d4, d5, d6, d7, d8, d9 );
end if;
loop
idx := -1;
--we want the lowest value of IDX > 0
for i in 1..delims.count loop
curidx := instr( str, delims(i), pos, 1 );
if curidx > 0 then
if idx = -1 or curidx < idx then
idx := curidx;
idx_delim := delims(i);
end if;
end if;
end loop;
if idx > 0 then
--if splitting on whitespace, treat any amount of it as
--a single delimiter
if d0 is not null or idx > pos then
pipe row( substr( str, pos, idx - pos ) );
end if;
else
-- also make sure to ignore trailing whitespace
if d0 is not null or pos <= len then
pipe row( substr( str, pos ) );
end if;
exit;
end if;
pos := idx + length( idx_delim );
end loop;
return;
end split;
function split( str in varchar2, delimiters in split_tbl := null )
return split_tbl pipelined is
i integer;
cursor spcur( d0 in varchar2 := null, d1 in varchar2 := null,
d2 in varchar2 := null, d3 in varchar2 := null,
d4 in varchar2 := null, d5 in varchar2 := null,
d6 in varchar2 := null, d7 in varchar2 := null,
d8 in varchar2 := null, d9 in varchar2 := null ) is
select column_value v from table (split(str,d0,d1,d2,d3,d4,d5,d6,d7,d8,d9));
function x( i in integer ) return varchar2 is
begin
if delimiters.exists(i) then
return delimiters(i);
else
return null;
end if;
end;
begin
for r in spcur( x(0),x(1),x(2),x(3),x(4),x(5),x(6),x(7),x(8),x(9) ) loop
pipe row( r.v );
end loop;
end split;
END;
Thanks

Curious behavior, but irrelevant, IMHO, since one never switches back and forth between two releases in the real world. All that STARTUP UPGRADE does is that it enables upgrade scripts to be run - it does not prevent statements like CREATE USER from being executed since the upgrade may create new needed accounts
http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve045.htm#SQPUG128
HTH
Srini

Similar Messages

  • Oracle object, nested table on a subtype

    Hello,
    Is it possible to have a nested table on a subtype? If it is, can someone help me?
    Here is what I need help for:
    I have a supertype WORK, that have:
    multivalued attribute ADDRESS
    a attribute NAME, also the primary key
    The subtype is called EMPLOYEE, that have:
    multivalued attribute SPECIALTY
    a attribute NAME
    a attribute SSN
    So far have I got:
    //* The supertype *//
    create or replace type ADRESS_TP as object(
    ADRESS varchar2(50));
    create or replace type ADRESSTP as table of ADRESS_TP;
    create or replace WORK_TP as object(
    NAME varchar2(30),
    ADRESS ADRESSTP)
    NOT FINAL;
    create table WORK_TBL of WORK_TP(
    Primary key(NAME))
    nested table ADRESS store as NT_ADR(
    (Primary key(nested_table_id, ADRESS))
    organization index compress);
    //* The subtype *//
    create or replace type SPECIALTY_TP as object(
    ADRESS varchar2(50));
    create or replace type SPECIALTYTP as table of SPECIALTY_TP;
    create or replace EMPLOYEE_TP under work_tp(
    NAME varchar2(30),
    SSN number)
    FINAL;
    The multivalued attribute SPECIALTYTP has to be declared in WORK_TBL have I been told, but how can I do that?
    I'm using oracle 9i

    I'm not really sure what your problem is. In future please be specific about what it is you are trying to do and what it is that is not working. If it's an error please give us the error message and number. It's not the behaviour you are expecting please describe what it does. If it's that you simply don't understand please say what you don't understand.
    I go on like this because the code you have posted is somewhat confusing. The Oracle object-oriented implementation is not quite complete so that makes it hard for people who know OO but don't know Oracle. Whereas most of us who know Oracle aren't expert in OO. Also, I think you should be slightly more inventive in your names: there's so many things called ADRESS it's easy to get them tangled up.
    Anyway, here's my guess at what I think your problem is....
    SQL> CREATE OR REPLACE TYPE adress_t AS OBJECT(
      2  line1 VARCHAR2(50)
      3  ,line2 VARCHAR2(50)
      4  ,postcode VARCHAR2(8));
      5  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE adress_nt AS TABLE OF adress_t;
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE work_t AS OBJECT(
      2   name VARCHAR2(30),
      3   adresses adress_nt)
      4  NOT FINAL;
      5  /
    Type created.
    SQL> CREATE TABLE work_tbl OF work_t
      2     NESTED TABLE adresses STORE AS adress_ntab
      3  /
    Table created.
    SQL> CREATE OR REPLACE TYPE specialty_t AS OBJECT(
      2  description VARCHAR2(50));
      3  /
    Type created.
    SQL> CREATE OR REPLACE TYPE specialty_nt AS TABLE OF specialty_t;
      2  /
    Type created.
    SQL>
    SQL> ALTER TYPE work_t ADD ATTRIBUTE specialities specialty_nt CASCADE
      2  /
    Type altered.
    SQL> DESC work_tbl
    Name                                      Null?    Type
    NAME                                               VARCHAR2(30)
    ADRESSES                                           ADRESS_NT
    SPECIALITIES                                       SPECIALTY_NT
    SQL> Cheers, APC

  • Nested Table having more than 1 column comparison using ORACLE MULTISET

    Dear ALL,
    I am using ORACLE 10gR2 Database.
    I am currently trying to compare two sets of data that I get from two queries in PL/SQL. I want to use Oracle MULTISET UNION, MULTISET INTERSECT, MULTISET EXCEP for those operations.
    But When I am executing the below given code I am getting the error.
    PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
    My Code
    declare
    type wh_unique_record is record (cpy_key number(22),cnc_id varchar2(22),cust_type_id number,
    device_info_id number,scope_id number,excep_id number,
    config_date date);
    type wh_previous_data_table is table of wh_unique_record;
    wh_previous_data wh_previous_data_table;
    wh_current_data wh_previous_data_table;
    wh_union_data wh_previous_data_table;
    wh_intersect_data wh_previous_data_table;
    -- This cursor I am using to populate the data into the nested tables
    cursor c_previous_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
    from r_cfg_wh_excep
    where cpy_key=17278
    and trunc(config_date)=trunc(to_date('06-jul-2009','dd-mon-yyyy'));
    cursor c_current_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
    from r_cfg_wh_excep
    where cpy_key=17278
    and trunc(config_date)=trunc(to_date('16-jul-2009','dd-mon-yyyy'));
    begin
    open c_previous_data;
    fetch c_previous_data bulk collect into wh_previous_data;
    close c_previous_data;
    open c_current_data;
    fetch c_current_data bulk collect into wh_current_data;
    close c_current_data;
    dbms_output.put_line('Previous count '||wh_previous_data.count);
    dbms_output.put_line('Current count '||wh_current_data.count);
    --FYI: MULTISET UNION IS WORKING.*
    wh_union_data := wh_current_data multiset union wh_previous_data;
    dbms_output.put_line('New count '||wh_union_data.count);
    wh_intersect_data:=wh_current_data MULTISET EXCEPT  wh_previous_data;
    dbms_output.put_line('The records that are repeating are  '||wh_intersect_data.count);
    end;
    Previous count 74062
    Current count 74508
    New count 148570
    PL/SQL procedure successfully completed.
    FYI: If I comment the MULTISET EXCEPT conditin then I am getting the output for MULTISET UNION.
    IS THERE ANY WAY ORACLE IS PROVIDING A FUNCTIONALITY WHERE WE CAN HAVE A NESTED TABLE WITH MULTIPLE COLUMNS AND THAT CAN BE USED IN PL/SQL AND USE BULK OPERATION TO POPULATE THE NESTED TABLE WITH MULTIPLE COLUMNS AND USE THE SAME IN MULTISET EXCEPT, MULTISET EXCEPT ETC.
    Appreciate your help on this.
    Thanks,
    Madhu K.

    Madhu,
    I am totally amazed. I didn't think any of the MULTISET operations would work with NTs of records. Lucky you!
    As for the EXCEPT, well, clearly it is a restriction or bug in PL/SQL.
    You may want to report it to Oracle Support.
    Regards,SF
    At 11:45 AM 10/1/2009, you wrote:
    Dear Steven,
    I am using ORACLE 10gR2 Database.
    I am currently trying to compare two sets of data that I get from two queries in PL/SQL. I want to use Oracle MULTISET UNION, MULTISET INTERSECT, MULTISET EXCEP for those operations.
    But When I am executing the below given code I am getting the error.
    PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
    My Code
    declare
    type wh_unique_record is record (cpy_key number(22),cnc_id varchar2(22),cust_type_id number,
    device_info_id number,scope_id number,excep_id number,
    config_date date);
    type wh_previous_data_table is table of wh_unique_record;
    wh_previous_data wh_previous_data_table;
    wh_current_data wh_previous_data_table;
    wh_union_data wh_previous_data_table;
    wh_intersect_data wh_previous_data_table;
    -- This cursor I am using to populate the data into the nested tables
    cursor c_previous_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
    from r_cfg_wh_excep
    where cpy_key=17278
    and trunc(config_date)=trunc(to_date('06-jul-2009','dd-mon-yyyy'));
    cursor c_current_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
    from r_cfg_wh_excep
    where cpy_key=17278
    and trunc(config_date)=trunc(to_date('16-jul-2009','dd-mon-yyyy'));
    begin
    open c_previous_data;
    fetch c_previous_data bulk collect into wh_previous_data;
    close c_previous_data;
    open c_current_data;
    fetch c_current_data bulk collect into wh_current_data;
    close c_current_data;
    dbms_output.put_line('Previous count '||wh_previous_data.count);
    dbms_output.put_line('Current count '||wh_current_data.count);
    --FYI: MULTISET UNION IS WORKING.
    wh_union_data := wh_current_data multiset union wh_previous_data;
    dbms_output.put_line('New count '||wh_union_data.count);
    wh_intersect_data:=wh_current_data MULTISET EXCEPT wh_previous_data;
    dbms_output.put_line('The records that are repeating are '||wh_intersect_data.count);
    end;
    Previous count 74062
    Current count 74508
    New count 148570
    PL/SQL procedure successfully completed.
    FYI: If I comment the MULTISET EXCEPT conditin then I am getting the output for MULTISET UNION.
    IS THERE ANY WAY ORACLE IS PROVIDING A FUNCTIONALITY WHERE WE CAN HAVE A NESTED TABLE WITH MULTIPLE COLUMNS AND THAT CAN BE USED IN PL/SQL AND USE BULK OPERATION TO POPULATE THE NESTED TABLE WITH MULTIPLE COLUMNS AND USE THE SAME IN MULTISET EXCEPT, MULTISET EXCEPT ETC.
    Appreciate your help on this.
    Thanks,
    Madhu K.

  • Nesting nested table

    Can a nested table Tab1 have another nested table Tab2 as an attribute? If yes, when the declaration of storing (e.g., nested table Tab2 store as Tab2_TAB) goes, in nested table Tab1 declaration (create type Tab1 as table of ...) or in Create table X that used double nested tables? THANKS for whoever can help me that!!!!! Elka

    Multi-level nesting is only available since 9i. Before that, you'd need to break out the nesting as references to other object tables. Which is still a viable option depending on the business rules of your system. You're code was basically right, I just added an object table of type d_t with the syntax to provide storage for all the nested tables and ran a test insert to make sure you could get data in. Works fine. If you select * from that new table you'll see everything, but you may want to de-nest to only get specific data so you'll need to use the table function in your select statement. The oracle docs for all of this are quite good in the 'Application Developer's Guide - Object-Relational Features'. Check it out, and good luck!
    Jason Ladd
    E-Tech Solutions
    create type a_t as object (
    foobar varchar(20)
    create type a_list_t as table of a_t
    create type b_t as object (
    foo_b varchar2(20),
    foo_b_list a_list_t
    create type b_list_t as table of b_t
    create type c_t as object (
    foo_c varchar2(20),
    foo_c_list b_list_t
    create type c_list_t as table of c_t
    create type d_t as object (
    foo_d varchar2(20),
    foo_d_list c_list_t
    create table d_table of d_t
    nested table foo_d_list store as d_ntab1
    (nested table foo_c_list store as d_ntab2
    (nested table foo_b_list store as d_ntab3
    insert into d_table values(
    'foo_d',
    (c_list_t(c_t('foo_c',(b_list_t(b_t('foo_b',(a_list_t(a_t('foobar')))))))))

  • [svn] 3403: Fix for SDK-17097 - Missing summary description of a class in package classes table

    Revision: 3403
    Author: [email protected]
    Date: 2008-09-29 12:36:37 -0700 (Mon, 29 Sep 2008)
    Log Message:
    Fix for SDK-17097 - Missing summary description of a class in package classes table
    QA: Yes
    Doc:
    Tests: checkintests
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17097
    Modified Paths:
    flex/sdk/trunk/asdoc/templates/class-files.xslt

    Well, it's kind of logical that as you put more jar files (classes) in Tomcat, it changes the error to ask for the classes (inside a jar) it cannot find.
    There was a good class->jar finder on the internet some years ago, but i don't remember the address. Try looking for that and search all the missing classes (NotDefined) and their correspondig jar files.
    Good Luck!

  • Open a cursor containing a nested table?

    I have created a table with several nested tables by following the examples in: http://otn.oracle.com/docs/products/oracle8/doc_index.htm
    I am now trying to query one of these nested tables using the techniques that are described.
    The two techniques are (page 31 of above reference):
    (1) "Flattened" query.
    (2) Nested cursor
    Both of these techniques work by simple SQL queries in SQl*Plus.
    However, I get compilation errors when using identical queries when trying to open and return a cursor in a stored procedure.
    Can you please help? Is this supported in 8.1.7?
    Is there a better way to query and return data using OO4O to a windows client program?
    If necessary, I would be glad to provide code samples.
    Thank you,
    Casey Cummings

    Here is a copy of my test code for the question that I posted. Any help on how I can get nested table data back to a windows client would be greatly apreciated.
    Thank you.
    Casey Cummings
    --DDL.
    --Original table.
    CREATE TABLE MY_TABLE(
    MY_KEY INTEGER,
    MY_DATA VARCHAR2(2000));
    --Basic Object types.
    CREATE TYPE MY_NUMERIC_OBJTYP AS OBJECT(
    SEQUENCE INTEGER,
    DATUM NUMBER);
    CREATE TYPE MY_TEXT_OBJTYP AS OBJECT(
    SEQUENCE INTEGER,
    DATUM VARCHAR2(255));
    --Table type. Table of basic objects.
    CREATE TYPE MY_NUMERIC_TABTYP AS TABLE OF MY_NUMERIC_OBJTYP;
    CREATE TYPE MY_TEXT_TABTYP AS TABLE OF MY_TEXT_OBJTYP;
    --Add nested tables to original table.
    ALTER TABLE MY_TABLE ADD(
    MY_NUMERIC_NTAB MY_NUMERIC_TABTYP)
    NESTED TABLE MY_NUMERIC_NTAB STORE AS MY_NUMERIC_TABLE;
    ALTER TABLE MY_TABLE ADD(
    MY_TEXT_NTAB MY_TEXT_TABTYP)
    NESTED TABLE MY_TEXT_NTAB STORE AS MY_TEXT_TABLE;
    --Insert test data in the main, unnested table.
    INSERT INTO MY_TABLE(
    MY_KEY, MY_DATA
    )VALUES(
    1001, 'RECORD-1001');
    COMMIT;
    --Create the actual nested tables.
    UPDATE MY_TABLE SET
    MY_NUMERIC_NTAB = MY_NUMERIC_TABTYP();
    UPDATE MY_TABLE SET
    MY_TEXT_NTAB = MY_TEXT_TABTYP();
    COMMIT;
    --Insert test data into the nested tables.
    INSERT INTO TABLE(
    SELECT X.MY_NUMERIC_NTAB
    FROM MY_TABLE X
    WHERE MY_KEY = 1001
    )VALUES(
    1,901);
    INSERT INTO TABLE(
    SELECT X.MY_NUMERIC_NTAB
    FROM MY_TABLE X
    WHERE MY_KEY = 1001
    )VALUES(
    2,902);
    INSERT INTO TABLE(
    SELECT X.MY_NUMERIC_NTAB
    FROM MY_TABLE X
    WHERE MY_KEY = 1001
    )VALUES(
    3,903);
    INSERT INTO TABLE(
    SELECT X.MY_TEXT_NTAB
    FROM MY_TABLE X
    WHERE MY_KEY = 1001
    )VALUES(
    1,'ONE');
    COMMIT;
    BOTH OF THESE QUERYS WORK WHEN ENTERED IN SQL*PLUS.
    --"FLATTENED" QUERY
    SELECT X.MY_DATA, N.SEQUENCE, N.DATUM, T.SEQUENCE, T.DATUM
    FROM
    MY_TABLE X,
    TABLE(X.MY_NUMERIC_NTAB) N,
    TABLE(X.MY_TEXT_NTAB) T
    WHERE X.MY_KEY = 1001;
    --"CURSOR" QUERY
    SELECT X.MY_DATA,
    CURSOR(
    SELECT *
    FROM TABLE (MY_NUMERIC_NTAB) ),
    CURSOR(
    SELECT *
    FROM TABLE (MY_TEXT_NTAB) )
    FROM MY_TABLE X
    WHERE X.MY_KEY = 1001;
    CREATE OR REPLACE PACKAGE MANAGE_TEST AS
    TYPE THE_CURSOR IS REF CURSOR;
    PROCEDURE QUERY_TEST(
    MY_CURSOR IN OUT THE_CURSOR
    END;
    CREATE OR REPLACE PACKAGE BODY MANAGE_TEST AS
    PROCEDURE QUERY_TEST(
    MY_CURSOR IN OUT THE_CURSOR
    AS
    BEGIN
    OPEN MY_CURSOR FOR
    --"FLATTENED" QUERY
    SELECT X.MY_DATA, N.SEQUENCE, N.DATUM, T.SEQUENCE, T.DATUM
    FROM
    MY_TABLE X,
    TABLE(X.MY_NUMERIC_NTAB) N,
    TABLE(X.MY_TEXT_NTAB) T
    WHERE X.MY_KEY = 1001;
    END;
    END;
    *****************Errors:
    LINE/COL ERROR
    8/5 PL/SQL: SQL Statement ignored
    11/13 PLS-00201: identifier 'X.MY_NUMERIC_NTAB' must be declared
    CREATE OR REPLACE PACKAGE BODY MANAGE_TEST AS
    PROCEDURE QUERY_TEST(
    MY_CURSOR IN OUT THE_CURSOR
    AS
    BEGIN
    OPEN MY_CURSOR FOR
    --"CURSOR" QUERY
    SELECT X.MY_DATA,
    CURSOR(
    SELECT *
    FROM TABLE (MY_NUMERIC_NTAB) ),
    CURSOR(
    SELECT *
    FROM TABLE (MY_TEXT_NTAB) )
    FROM MY_TABLE X
    WHERE X.MY_KEY = 1001;
    END;
    END;
    *****************Errors:
    LINE/COL ERROR
    11/11 PLS-00103: Encountered the symbol "SELECT" when expecting one of
    the following:
    ( ) - + mod not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable>
    table avg count current exists max min prior sql stddev sum
    variance execute multiset the both leading trailing forall
    year month DAY_ HOUR_ MINUTE_ second TIMEZONE_HOUR_
    TIMEZONE_MINUTE_ time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL stri
    12/41 PLS-00103: Encountered the symbol "," when expecting one of the
    following:
    ; return returning and or
    null

  • Oracle DB 10g to 11g Upgrade

    Hi,
    We have a SAP Oracle Database, the size is 1.5 TB.
    The Hardware details are
    Application – SAP ERP 6.0 EHP5 SPS6
    Database – Oracle 10.2.0.2
    OS Platform – AIX 5.3 TL05, SP06
    HW – 8 Dual Core CPU’s, 256 GB RAM on DB-CI server
    Test Environment : 32 GB RAM
    Please from your experience let me know how much time will a 10g to 11g upgrade will take.
    Regards,
    Narayan

    hi,
    There are several parameters you have to check before upgrading. Commonly it is independent of size of database.I think it will take as minimum 1 hour. Check the links to speed up upgrading and to consider pre-upgrade preparation:
    https://blogs.oracle.com/UPGRADE/entry/how_long_will_your_upgrade_tak
    http://www.oracle.com/technetwork/database/upgrade/best-practices-for-upgrading-11gr2-174946.pdf

  • About nested tables in oracle 8i

    hello,
    actually i am working with oracle 8.1.5 's nested tables
    concept...
    here is a description of my tables
    create type parameterranges
    parameter_name varchar2(20),
    min_value number(10),
    max_value number(10)
    create type parameter_ran as table of parameterranges
    create table material_details
    mat_type varchar2(20),
    parameter_ranges parameter_ran
    okay...
    now my doubt is how do i place constraints on the nested table fields i.e on min_value etc...(especially NOT NULL
    constraint)
    DOUBT NO 2
    =============
    I have a query to find out the mat_type,partno from material_details table Based on the parameter value and its min_value ,i.e based on some name value pairs which I am achieving as below .
    select m.mat_type,m.partno
    from material_details m,table(m.parameter_ranges) p
    where p.parameter ='THICKNESS' and p.min_value = '1'
    and m.mat_type='STEEL'
    intersect
    select m.mat_type, m.partno
    from material_details m,table(m.parameter_ranges) p
    where p.parameter ='STANDARD' and p.min_value = 'SAE1010'
    and m.mat_type='STEEL';
    Now I want this to be in a cursor..i.e I want to use the same set of rows returned by the above in another query involving another table .
    That is using the multiple mat_type and partno returned from above I want to find out
    Other fields (company,plant) from another table part_details which also has a nested table in it
    How do I go about this???Actually I want to use these in a PLSQL procedure where we can have row by row control of the rows returned ,that is why I want a cursor.......
    could u think about this too...and if possible mail me at my yahoo id ..
    thanx once again
    please reply to my id
    [email protected]
    thanx
    null

    I don't understand exactly your problem. Can you send me a mail which expresses your problem??

  • Nested Tables - Oracle Crashes !

    Hello Everyone
    You might help me to sleep tonight.
    Ok, here is the problem.
    I used a nested table to collect data. After collection, I get repeated records in collection result. I tried to operate to get a distinct result operating SQL operation but oracle gives nasty error and kicks me out the session.
    HERE is the code :
    create or replace package rule_engine
    as
    type t_course_count is table of number(2);
    Procedure main;
    end rule_engine;
    create or replace package body rule_engine
    as
    procedure main
    is
    v_course_count t_course_count:=t_course_count(1,2,3,4);
    i t_course_count;
    begin
    insert into table(i) select * from table(v_course_count);
    end main;
    end rule_engine;
    null

    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> CREATE OR REPLACE TYPE table_type AS TABLE OF VARCHAR2 (8);
      2  /
    Type created.
    SQL> CREATE TABLE r(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_1;
    Table created.
    SQL> CREATE TABLE s(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_2;
    Table created.
    SQL> INSERT INTO r VALUES (1, table_type ('a', 'b'));
    1 row created.
    SQL> INSERT INTO s VALUES (1, table_type ('b', 'c'));
    1 row created.
    SQL> COLUMN c FORMAT A10;
    SQL> SELECT r.a, r.b MULTISET UNION DISTINCT s.b c
      2  FROM   r, s
      3  WHERE  r.a = s.a;
             A C
             1 TABLE_TYPE('a', 'b', 'c')
    SQL>

  • Problems with Whitespace using nested tables from eclipse dtp oracle plugin

    Hi,
    sending from eclipse to oracle xe fails if whitespace is used:
    Example1: Nested table in nested table
    adress_table_typ has another nested table in it
    that works
    CREATE TABLE x (
    i INTEGER PRIMARY KEY,
    adressen adress_table_typ
    ) NESTED TABLE adressen STORE AS adressen_nt (NESTED TABLE tels STORE AS tels_nt);
    inserting a newline fails
    CREATE TABLE x (
    i INTEGER PRIMARY KEY,
    adressen adress_table_typ
    ) NESTED TABLE adressen STORE AS adressen_nt
    (NESTED TABLE tels STORE AS tels_nt);
    Example2:
    Two nested tables
    CREATE TABLE x (
    i INT PRIMARY KEY,
    l_table_typ,
    m_table_typ
    ) NESTED TABLE laptops STORE AS laptop_nt NESTED TABLE interessen STORE AS interessen_nt;
    and then an insert
    INSERT INTO x VALUES (123456,
    l_typ(laptop_typ('123', 'netop'),
    laptop_typ('234', 'thinkpad'),     
    laptop_typ('345', 'iBook')),
    m_typ('a', 'b', 'c')
    which fails. Note that the INSERT works when copy&pasted to sqlplus. It also works if there is
    just one nested table.
    Am I doing somethig wrong or is this a bug in the eclipse data tools plugin?
    Regards
    - Peter
    PS; It is rather difficult to insert whitespace in that forum editor. Any possibility to have ascii?
    For a "whitespace" question rather important...

    A bit of an update on the original post. I was playing around with the plug-in xml file (e.g. eclipse\plugins\org.eclipse.jst.server.generic.oc4j_1.5.100.v20070608\buildfiles\oracle.10.1.3.xml). I changed the following from "deploy" to "redeploy" and it seems to be working once the applicatoin is initial deployed. Of course, I have to change it back to "deploy" if it is the first time the application is being deployed. However; I would still would like to resolve this if there is something out there that fixes this problem. Or if everything points to an enviornment problem, I can continue to play with it.
    <target name="deploy.j2ee.ear" depends="check.skip.ear.deploy" unless="skip.deploy">
    <antcall target="package.module.ear"/>
    <oracle:redeploy
    deployerUri="${deployer.uri}"
    userId="${oc4j.admin.user}"
    password="${oc4j.admin.password}"
    file="${server.publish.dir}/${module.name}.ear"
    deploymentName="${module.name}"
    bindAllWebApps="${oc4j.bind.website}"/>
    </target>

  • Oracle 11g upgrade: How to update stale statistics for sys and sysman?

    Hi,
    I am in the process of testing Oracle 11g upgrade from Oracle 10.2.0.3. I have run utlu111i.sql on the 10g database.
    The utility utlu111i.sql reports about the stale statistics for SYS and SYSMAN components.
    I executed dbms_stats.gather_dictionary_stats; dbms_stats.gather_schema_stats('SYS'); and dbms_stats.gather_schema_stats('SYSMAN');
    After that the utlu111i.sql still reports the stale statistics for sys and sysman. Does anyone know how to get rid off this warning successfully?
    Thanks,
    Sreekanth

    Does anyone know how to get rid off this warning successfully?Just ignore the warnings. Check The Utlu111i.Sql Pre-Upgrade Script Reports Stale Sys Statistics - 803774.1 from Metalink.

  • 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 way

    Why 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.

  • Nested tables and multiset operators in Oracle 10g

    Consider the following scenario:
    We have two identical relations R and S defined as:
    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;
    where table_typ is defined as
    CREATE TYPE table_typ AS TABLE OF VARCHAR2(8);
    Suppose we have two instances of R and S, each having one tuple as follows: R(1,table_typ('a','b')) and S(1,table_typ('b','c')).
    I would like to "merge" these two simple instances (e.g., achieve the effect of a simple SELECT * FROM R UNION SELECT * FROM S query) and obtain the following resulting instance: Result(1,table_typ('a','b','c')).
    Would this be possible in Oracle 10g? A simple UNION does not work (I got a "inconsistent datatypes: expected - got SCOTT.TABLE_TYP" error). I also took a look at the MULTISET UNION operator over nested tables available in Oracle 10g, but it doesn't seem to get me anywhere. Any help on this would be greatly appreciated.
    Thank you,
    Laura

    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> CREATE OR REPLACE TYPE table_type AS TABLE OF VARCHAR2 (8);
      2  /
    Type created.
    SQL> CREATE TABLE r(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_1;
    Table created.
    SQL> CREATE TABLE s(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_2;
    Table created.
    SQL> INSERT INTO r VALUES (1, table_type ('a', 'b'));
    1 row created.
    SQL> INSERT INTO s VALUES (1, table_type ('b', 'c'));
    1 row created.
    SQL> COLUMN c FORMAT A10;
    SQL> SELECT r.a, r.b MULTISET UNION DISTINCT s.b c
      2  FROM   r, s
      3  WHERE  r.a = s.a;
             A C
             1 TABLE_TYPE('a', 'b', 'c')
    SQL>

  • Unable to retrieve data from a nested table in Oracle 8i from JSP

    How do i retrieve data from a nested table in Oracle 8i from my JSP code?
    When i try to execute the query , a general error is thrown.
    Kindly advice as soon as possible.

    How do i retrieve data from a nested table in Oracle 8i from my JSP code?
    When i try to execute the query , a general error is thrown.
    Kindly advice as soon as possible.

  • MERGE using nested table doesn't work on Oracle 9i

    Hi,
    Oracle 9i Enterprise Edition Release 9.2.0.4.0 on Red hat Linux
    SQL> create table PERSONS (
      2    ID  number(9)
      3   ,SURNAME  varchar2(50)
      4   ,constraint PERSONS_PK primary key (ID)
      5  );
    Table created.
    SQL> create or replace type T_NUMBER_ARRAY as table of number;
      2  /
    Type created.
    SQL> create or replace procedure P_MRGTS2 (P_ID  PERSONS.ID%type)
      2  is
      3    L_IDS  T_NUMBER_ARRAY;
      4  begin
      5    L_IDS := T_NUMBER_ARRAY(P_ID);
      6    merge into PERSONS P using (select * from table(L_IDS)) D on (
      7      P.ID = D.COLUMN_VALUE
      8    )
      9    when matched then update
    10      set SURNAME = 'Updated'
    11    when not matched then
    12      insert (
    13        ID
    14       ,SURNAME
    15      )
    16      values (
    17        D.COLUMN_VALUE
    18       ,'Inserted'
    19      );
    20  end;
    21  /
    Procedure created.
    SQL> exec P_MRGTS2(1)
    BEGIN P_MRGTS2(1,'Avi'); END;
    ERROR at line 1:
    ORA-22905: cannot access rows from a non-nested table item
    ORA-06512: at "OPS$AABRAMI.P_MRGTS2", line 9
    ORA-06512: at line 1However, the same code on Oracle 10g Release 10.2.0.1.0 on SUN Solaris 9 works.
    Is there any way to make it work on Oracle 9i?
    One way I found is the following:
    procedure P_MRGTST (P_ID  PERSONS.ID%type)
    is
      L_IDS  T_NUMBER_ARRAY;
    begin
      L_IDS := T_NUMBER_ARRAY(P_ID);
      forall I in L_IDS.first..L_IDS.last
        merge into PERSONS P using DUAL D on (
          P.ID = L_IDS(I)
        when matched then update
          set SURNAME = 'Updated'
        when not matched then
          insert (
            ID
           ,SURNAME
          values (
            L_IDS(I)
           ,'Inserted'
    end;On Oracle 10g there is negligible difference in time taken to execute both procedures, as displayed in SQL*Plus when issuing:
    set timing onIs there something that makes one of the procedures preferrable over the other?
    Thanks,
    Avi.

    Is there any way to make it work on Oracle 9i?
    michaels>  select * from v$version
    BANNER                                                         
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production                          
    CORE     9.2.0.8.0     Production                                      
    TNS for HPUX: Version 9.2.0.8.0 - Production                   
    NLSRTL Version 9.2.0.8.0 - Production                          
    michaels>  create table persons (
        id  number(9)
           ,surname  varchar2(50)
              ,constraint persons_pk primary key (id)    )
    Table created.
    michaels>  create or replace type t_number_array as table of number;
    Type created.
    michaels>  create or replace procedure p_mrgts2 (p_id persons.id%type)
    is
       l_ids   t_number_array;
    begin
       l_ids := t_number_array (p_id);
       merge into persons p
          using (select * from table (cast (l_ids as t_number_array))) d
          on (p.id = d.column_value)
          when matched then
             update set surname = 'Updated'
          when not matched then
             insert (id, surname) values (d.column_value, 'Inserted');
    end p_mrgts2;
    Procedure created.
    michaels>  exec p_mrgts2(1)
    PL/SQL procedure successfully completed.
    michaels>  select * from persons
            ID SURNAME                                          
             1 Inserted                                         
    1 row selected.

Maybe you are looking for