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

Similar Messages

  • Nested table in a subtype

    Hi,
    A question: Is it possible to have a nested table on a subtype?
    If yes : How to declare the storage table for the nested table.
    I will be really grateful for any help here.
    Nina

    Is it what you need ?
    SQL> create or replace type nt_type is table of number;
      2  /
    Type created.
    SQL> create or replace type nt_obj is object (id number, ntt nt_type);
      2  /
    Type created.
    SQL> create table t (id number, ntobj nt_obj)
      2  nested table ntobj.ntt store as nest_tab;
    Table created.Rgds.

  • Working with oracle object type tables

    Hi,
    I've created a table which only contains Oracle object types (e.g. CREATE TABLE x OF <...>). When I create an Entity for this table using the Entity wizard, I end up with an entity with the attributes of the base object type and two special attributes REF$ (reference to the object type instance) and SYS_NC_OID$ (unique object identifier). The REF$ attribute is on the Java side of type oracle.jbo.domain.Ref and the other attribute is on the Java side a simple String.
    It seems this only allows me to save objects of the base type in this table. First of all in my situation this is also impossible because the base type is not instantiable. What I do want is to save several different subtypes into this table using the BC4J custom domain mechanism. Is there any way to make this possible? I first thought I could maybe do something with the special REF$ attribute, but this doesn't seem te case. So I might need to override most of the EntityImpl methods, like doUML, remove etc. Am I right? And does anyone have any hints on how to do this?
    Regards,
    Peter

    Peter:
    Hi,
    I've created a table which only contains Oracle
    object types (e.g. CREATE TABLE x OF <...>).
    When I create an Entity for this table using the
    Entity wizard, I end up with an entity with the
    attributes of the base object type and two special
    attributes REF$ (reference to the object type
    instance) and SYS_NC_OID$ (unique object identifier).
    The REF$ attribute is on the Java side of type
    oracle.jbo.domain.Ref and the other attribute is on
    the Java side a simple String.
    It seems this only allows me to save objects of the
    base type in this table. First of all in my situation
    this is also impossible because the base type is not
    instantiable. What I do want is to save several
    different subtypes into this table using the BC4J
    custom domain mechanism. Is there any way to make
    this possible? Sorry, but this is not supported out of the box.
    Since you have an object table, you wouldn't use domains to achieve this. Instead, you would have a superclass and subclass entity objects, e.g., PersonEO subclassed into StudentEO and EmployeeEO.
    I first thought I could maybe do
    something with the special REF$ attribute, but this
    doesn't seem te case. So I might need to override
    most of the EntityImpl methods, like doUML, remove
    etc. Am I right? And does anyone have any hints on
    how to do this?
    If you want, you can try this by overridding EntityImpl's:
       protected StringBuffer buildDMLStatement(int operation,
          AttributeDefImpl[] allAttrs,
          AttributeDefImpl[] retCols,
          AttributeDefImpl[] retKeys,
          boolean batchMode)
    and
       protected int bindDMLStatement(int operation,
          PreparedStatement stmt,
          AttributeDefImpl[] allAttrs,
          AttributeDefImpl[] retCols,
          AttributeDefImpl[] retKeys,
          HashMap retrList,
          boolean batchMode) throws SQLException
    Handle the case when operation == DML_INSERT.
    There, build an insert statement with substitutable row, e.g.:
    INSERT INTO persons VALUES (person_t('Bob', 1234));
    INSERT INTO persons VALUES (employee_t('Joe', 32456, 12, 100000));
    where person_t and employee_t are database types and you are invoking the respective constructor.
    Thanks.
    Sung

  • 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

  • Oracle Object Table Type

    I have an application that I would like to map bc4j to a object type hierarchy in the database. From reading previous otn threads I'm under the impression that Domains are not used for Oracle Table Types, just for columns based on oracle types. The thread later goes on to say that for the base type (person_typ) I would map a entity object to the table(person_table) mapped to the base type. To map all the sub-types I would create new entity objects and have PersonEO subclassed into StudentEO and EmployeeEO.
    I have done this and it's unclear to me when I subclass PersonEO as StudentEO how do I declare that StudentEO is of oracle object type student_typ?
    I'm also having problems with inserting data into the base entity obect. Here's code:
    PersonVOImpl personVo = am.getPersonVO();
    PersonVORowImpl row = (PersonVORowImpl)personVo.createRow();
    personVo.insertRow(row);
    row.setName("Mark");
    row.setPhone("911");
    am.getTransaction().commit();
    personVo.executeQuery();
    while (personVo.hasNext()){
    PersonVORowImpl personRow = (PersonVORowImpl)personVo.next();
    The data gets comitted to the db correctly but when the code hits personVo.executeQuery() I get the following error:
    oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:oracle.sql.STRUCT with value:Mark
         at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:687)
         at oracle.jbo.domain.TypeFactory.getInstance(TypeFactory.java:80)
         at oracle.jbo.server.OracleSQLBuilderImpl.doLoadBulkFromResultSet(OracleSQLBuilderImpl.java:1113)
         at oracle.jbo.server.ViewRowImpl.populate(ViewRowImpl.java:2017)
         at oracle.jbo.server.ViewDefImpl.createInstanceFromResultSet(ViewDefImpl.java:1013)
         at oracle.jbo.server.ViewObjectImpl.createRowFromResultSet(ViewObjectImpl.java:2309)
         at oracle.jbo.server.ViewObjectImpl.createInstanceFromResultSet(ViewObjectImpl.java:2240)
         at oracle.jbo.server.QueryCollection.populateRow(QueryCollection.java:1698)
         at oracle.jbo.server.QueryCollection.fetch(QueryCollection.java:1552)
         at oracle.jbo.server.QueryCollection.get(QueryCollection.java:1008)
         at oracle.jbo.server.ViewRowSetImpl.getRow(ViewRowSetImpl.java:2791)
         at oracle.jbo.server.ViewRowSetIteratorImpl.doFetch(ViewRowSetIteratorImpl.java:2504)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2368)
         at oracle.jbo.server.ViewRowSetIteratorImpl.refresh(ViewRowSetIteratorImpl.java:2569)
         at oracle.jbo.server.ViewRowSetImpl.notifyRefresh(ViewRowSetImpl.java:1641)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:577)
         at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:611)
         at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:593)
         at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:2886)
         at model.testing.main(testing.java:33)
    Am I coding this correctly? I'm using jdev9032 for this. Are there any examples out there on how to correctly use bc4j with oracle object type tables?
    Thanks in advance!
    -Mark

    Here is my ddl:
    CREATE TYPE Person_typ AS OBJECT
    ( name VARCHAR2(30),
    address VARCHAR2(100)) NOT FINAL
    CREATE TABLE PERSON_TABLE OF PERSON_TYP
    I map a entity object to person_table one for one and I edit the SYS_NC_OID$ property of updateable to never.
    I then map a view object one for one to the entity object. The jbo trace I get when -Djbo.debugoutput=console is declared is the following (omitted everything before the db connected).[156] Successfully logged in
    [157] JDBCDriverVersion: 9.0.1.4.0
    [158] DatabaseProductName: Oracle
    [159] DatabaseProductVersion: Personal Oracle9i Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production
    [160] ViewRowSetImpl's jbo.viewlink.consistent = false (0)
    [161] Column count: 3
    [162] Executing SQL in generateRefAndOID...
    [163] select a.oid, make_ref(PERSON_TABLE, a.oid) from (select /*+ NO_MERGE +*/ sys_op_guid() as oid from dual) a
    [164] OracleSQLBuilder Executing DML on: PERSON_TABLE (Insert)
    [165] INSERT INTO PERSON_TABLE(NAME,ADDRESS) VALUES (:1,:2)
    [166] BaseSQLBuilder: releaseSavepoint 'BO_SP' ignored
    [167] PersonVO notify COMMIT ...
    [168] Column count: 3
    [169] ViewObject : Created new QUERY statement
    [170] SELECT REF(PersonTable), PersonTable.NAME, PersonTable.ADDRESS FROM PERSON_TABLE PersonTable
    [171] LoadBulkFromResultSet failed (2)
    oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:oracle.sql.STRUCT with value:Mark
         java.lang.Object oracle.jbo.domain.TypeFactory.get(java.lang.Class, java.lang.Class, java.lang.Object)
              TypeFactory.java:687
         java.lang.Object oracle.jbo.domain.TypeFactory.getInstance(java.lang.Class, java.lang.Object)
              TypeFactory.java:80
         java.lang.Object[] oracle.jbo.server.OracleSQLBuilderImpl.doLoadBulkFromResultSet(oracle.jbo.server.AttributeDefImpl[], int, java.sql.ResultSet, int, oracle.jbo.server.DBTransactionImpl)
              OracleSQLBuilderImpl.java:1059
         void oracle.jbo.server.ViewRowImpl.populate(java.sql.ResultSet)
              ViewRowImpl.java:1964
         oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewDefImpl.createInstanceFromResultSet(oracle.jbo.server.ViewObjectImpl, oracle.jbo.server.QueryCollection, java.sql.ResultSet)
              ViewDefImpl.java:1019
         oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewObjectImpl.createRowFromResultSet(java.lang.Object, java.sql.ResultSet)
              ViewObjectImpl.java:2035
         oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewObjectImpl.createInstanceFromResultSet(oracle.jbo.server.QueryCollection, java.sql.ResultSet)
              ViewObjectImpl.java:1966
         oracle.jbo.server.ViewRowImpl oracle.jbo.server.QueryCollection.populateRow()
              QueryCollection.java:1395
         boolean oracle.jbo.server.QueryCollection.fetch(int)
              QueryCollection.java:1237
         java.lang.Object oracle.jbo.server.QueryCollection.get(int)
              QueryCollection.java:832
         oracle.jbo.Row oracle.jbo.server.ViewRowSetImpl.getRow(int)
              ViewRowSetImpl.java:2621
         void oracle.jbo.server.ViewRowSetIteratorImpl.doFetch(int)
              ViewRowSetIteratorImpl.java:2347
         void oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed()
              ViewRowSetIteratorImpl.java:2211
         void oracle.jbo.server.ViewRowSetIteratorImpl.refresh(boolean, boolean)
              ViewRowSetIteratorImpl.java:2412
         void oracle.jbo.server.ViewRowSetImpl.notifyRefresh(boolean, boolean)
              ViewRowSetImpl.java:1556
         void oracle.jbo.server.ViewRowSetImpl.execute(boolean, boolean)
              ViewRowSetImpl.java:548
         void oracle.jbo.server.ViewRowSetImpl.executeQuery()
              ViewRowSetImpl.java:564
         void oracle.jbo.server.ViewObjectImpl.executeQuery()
              ViewObjectImpl.java:2616
         void mypackage1.testing.main(java.lang.String[])
              testing.java:25
    Exception in thread main
    Process exited with exit code 1.
    Please let me know if you need more information.
    -Mark

  • How to use nested tables object in oracle form

    Hello forum
    How all r u ..
    i need ur help guys, pls help me out...
    i m using an object oriented approach to design my database by using nested tables and
    varrays. it is quite done successfully.
    but the problem is when i m trying to use that object of nested table into the datablock of the form it is not been added to item list of that block.
    so what is the proper way to use these type of objects to the form.
    all ideas are welcomed and vry much required.
    pls give example if possible so easy to understand or have any demo form related to above case then pls post me to my id i.e [email protected]
    thank u all and expecting some expert solutions

    Hello Francois Degrelle...
    How r u doing ... i have searched the forum abt the above mentioned topic then i found that u have some demo form which will help out to explain the functionality of the nested table in forms ..
    will u pls me that form to my i.e [email protected] pls mail all the detail u have regarding using nested tables to forms and reports
    lots of thanks to u n advance.

  • Printing out results in case of object-relational table (Oracle)

    I have made a table with this structure:
    CREATE OR REPLACE TYPE Boat AS OBJECT(
    Name varchar2(30),
    Ident number,
    CREATE OR REPLACE TYPE Type_boats AS TABLE OF Boat;
    CREATE TABLE HOUSE(
    Name varchar2(40),
    MB Type_boats)
    NESTED TABLE MB store as P_Boat;
    INSERT INTO House VALUES ('Name',Type_boats(Boat('Boat1', 1)));
    I am using java to print out all the results by calling a procedure.
    CREATE OR REPLACE package House_boats
    PROCEDURE add(everything works here)
    PROCEDURE results_view;
    END House_boats;
    CREATE OR REPLACE Package.body House_boats AS
    PROCEDURE add(everything works here) AS LANGUAGE JAVA
    Name House_boats.add(...)
    PROCEDURE results_view AS LANGUAGE JAVA
    Name House_boats.resuts_view();
    END House_boats;
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    CALL House_boats.results_view();
    House_boats.java file which is loaded using LOADJAVA:
    import java.sql.*;
    import java io.*;
    public class House_boats {
    public static void results_view ()
       throws SQLException
       { String sql =
       "SELECT * from House";
       try { Connection conn = DriverManager.getConnection
    ("jdbc:default:connection:");
       PreparedStatement pstmt = conn.prepareStatement(sql);
       ResultSet rset = pstmt.executeQuery();
      printResults(rset);
      rset.close();
      pstmt.close();
       catch (SQLException e) {System.err.println(e.getMessage());
    static void printResults (ResultSet rset)
       throws SQLException { String buffer = "";
       try { ResultSetMetaData meta = rset.getMetaData();
       int cols = meta.getColumnCount(), rows = 0;
       for (int i = 1; i <= cols; i++)
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       if (label.length() > size) size = label.length();
       while (label.length() < size) label += " ";
      buffer = buffer + label + " "; }
      buffer = buffer + "\n";
       while (rset.next()) {
      rows++;
       for (int i = 1; i <= cols; i++) {
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       String value = rset.getString(i);
       if (label.length() > size) size = label.length();
       while (value.length() < size) value += " ";
      buffer = buffer + value + " ";  }
      buffer = buffer + "\n";   }
       if (rows == 0) buffer = "No data found!\n";
       System.out.println(buffer); }
       catch (SQLException e) {System.err.println(e.getMessage());}  }
    How do I print out the results correctly in my case of situation?
    Thank you in advance

    I have made a table with this structure:
    I am using java to print out all the results by calling a procedure.
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    How do I print out the results correctly in my case of situation?
    There are several things wrong with your code and methodology
    1. The code you posted won't even compile because there are several syntax issues.
    2. You are trying to use/test Java in the database BEFORE you get the code working outside the DB
    3. Your code is not using collections in JDBC properly
    I suggest that you use a different, proven approach to developing Java code for use in the DB
    1. Use SIMPLE examples and then build on them. In this case that means don't add collections to the example until ALL other aspects of the app work properly.
    2. Create and test the Java code OUTSIDE of the database. It is MUCH easier to work outside the database and there are many more tools to help you (e.g. NetBeans, debuggers, DBMS_OUTPUT windows, etc). Trying to debug Java code after you have already loaded it into the DB is too difficult. I'm not aware of anyone, even at the expert level, that develops that way.
    3. When using complex functionality like collections first read the Oracle documentation (JDBC Developer Guide and Java Developer's Guide). Those docs have examples that are known to work.
    http://docs.oracle.com/cd/B28359_01/java.111/b31225/chfive.htm
    http://docs.oracle.com/cd/E11882_01/java.112/e16548/oraarr.htm#sthref583
    The main issue with your example is #3 above; you are not using collections properly:
    String value = rset.getString(i);
    A collection is NOT a string so why would you expect that to work for a nested table?
    A collection needs to be treated like a collection. You can even treat the collection as a separate result set. Create your code outside the database and use the debugger in NetBeans (or other) on this replacement code for your 'printResults' method:
    static void printResults (ResultSet rset) throws SQLException {
        try {
           ResultSetMetaData meta = rset.getMetaData();
           while (rset.next()) {
               ResultSet rs = rset.getArray(2).getResultSet();
               rs.next();
               String ndx = rs.getString(1);
               Struct struct = (Struct) rs.getObject(2);
               System.out.println(struct.getSQLTypeName());
               Object [] oa = struct.getAttributes();
               for (int j = 0; j < oa.length; j++) {
                  System.out.println(oa[j]);
        } catch  (SQLException e) {
           System.err.println(e.getMessage());
    That code ONLY deals with column 2 which is the nested table. It gets that collection as a new resultset ('rs'). Then it gets the contents of that nested table as an array of objects and prints out the attributes of those objects so you can see them.
    Step through the above code in a debugger so you can SEE what is happening. NetBeans also lets you enter expressions such as 'rs' in an evaluation window so you can dynamically try the different methods to see what they do for you.
    Until you get you code working outside the database don't even bother trying to load it into the DB and create a Java stored procedure.
    Since your current issue has nothing to do with this forum I suggest that you mark this thread ANSWERED and repost it in the JDBC forum if you need further help with this issue.
    https://forums.oracle.com/community/developer/english/java/database_connectivity
    When you repost you can include a link to this current thread if you want. Once your Java code is actually working then try the Java Stored procedure examples in the Java Developer's Guide doc linked above.
    At the point you have any issues that relate to Java stored procedures then you should post them in the SQL and PL/SQL forum
    https://forums.oracle.com/community/developer/english/oracle_database/sql_and_pl_sql

  • Performance impact using nested tables and object

    Hi,
    Iam using oracle 11g.
    While creating a package, iam using lot of nested tables created based on objects which will be passed between multiple functions in the package..
    Will it have any performance impact since all the data is stored in the memory.
    How can i measure the performance impact when the data grows ?
    Regards,
    Oracle User
    Edited by: user9080289 on Jun 30, 2011 6:07 AM
    Edited by: user9080289 on Jun 30, 2011 6:42 AM

    user9080289 wrote:
    While creating a package, iam using lot of nested tables created based on objects which will be passed between multiple functions in the package.. Not the best of ideas in general, in PL/SQL. This is not client code that can lay sole claim to most of the memory. It is server code and one of many server processes that need to share the available resources. So capitalism is fine on a client, but you need socialism on the server? {noformat} ;-) {noformat}
    Will it have any performance impact since all the data is stored in the memory.Interestingly yes. Usually crunching data in memory is better. In this case it may not be so. The memory used is the most expensive memory Oracle can use - the PGA. Private process memory. This means each process copy running that code, will need lots of memory.
    If you're not passing the data structures by reference, it means even bigger demands on memory as the data structure needs to be copied into the call stack and duplicated.
    The worse case scenario is that such code consumes so much free server memory, and make such huge demands on having that in pysical memory, it trashes memory management as the swap daemons are unable to keep up with the demand of swapping virtual memory pages into and out of memory. Most CPU time is spend by the swap daemons.
    I have seen servers crash due to this. I have seen a single PL/SQL process causing this.
    How can i measure the performance impact when the data grows ?Well, you need to look at the impact of your code on PGA memory. It is not SQL performance or I/O performance that is a factor - just how much private process memory your code needs in order to execute.

  • Varray, Nested Table and Object types in OWB r2

    Requirement:
    Flat file with repeating groups of nested content need to move into Object Relational ORACLE table (using varray or nested tables - no preference). The data will be loaded, then mapped/transformed into a richer O-R output to directly produce XML outputs.
    Problem:
    Generated PL/SQL "seems" to do the correct thing, but deployment errors show failures on mapping of collections (varrays, NTs or OTs) and in sqlplus recompiling the PKB still gives the errors. Is this a PL/SQL generator error, or is there a more meaningful example of using CONSTRUCT OBJECT operator than the embedded odcumentation - it is a simple type (single instance) and not a variable repeating group of nested data.
    Anyone had any success with these, or know of any collateral to assist in the process. Thanks.

    The process we are following is very simple. We are talking 10 columns from a source flat file table and wish to map this into a Varray/Nested table, with one column of Varchar2(10).
    When you create your map in OWB, select the construct object, you have to choose an object type - it does not allow you to select a VARAAY or NESTED table.
    I have then created an object defined in the same structure as the VARRAY/NESTED table - I have then made the VARRAY/NESTED table of this TYPE.
    Example:
    CREATE OR REPLACE TYPE "O_REL_PUB_INDEX" AS OBJECT (
    X_REL_PUB_INDEX_1 VARCHAR2(10))
    CREATE OR REPLACE TYPE "V_REL_PUB_INDEX" AS VARRAY(15) OF O_REL_PUB_INDEX
    In OWB you can then select O_REL_PUB_INDEX when creating the 'Contruct Object'.
    The problem I have is that when I map to my target column of type V_REL_PUB_INDEX and DEPLOY my map I get the following errors taken from OWB control centre
    Name
    Action
    Status
    Log
    TEST
    Create
    Warning
    ORA-06550: line 2931, column 9:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 3174, column 11:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    TEST
    Create
    Warning
    ORA-06550: line 401, column 7:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 643, column 13:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    TEST
    Create
    Warning
    ORA-06550: line 7221, column 9:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 7464, column 11:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    Any ideas? anyone succesfully mapped to either a VARRAY or an NESTED TABLE target column?

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

  • Nested table type in object view on 8.1.7

    Object views seem to be the ideal way to deliver XML datagrams from database queries with nested data.
    I need to create a datagram that contains nested data within another nested set of data eg. a family has many people, each person may have many hobbies.
    The following code taken from Oracle documentation would create the Types I need, but this does not work on 8.1.7 (gets PLS-00534 error). Can someone advise if nested tables within a table type is a new Oracle 9 feature?
    CREATE TYPE project_t AS OBJECT
    ( projname VARHCAR2(20)
    , mgr VARHCAR2(20));
    CREATE TYPE nt_project_t AS TABLE OF project_t;
    CREATE TYPE emp_t AS OBJECT
    ( ename VARCHAR2(20)
    , salary NUMBER
    , deptname VARHCAR2(20)
    , projects nt_project_t);
    CREATE TYPE nt_emp_t AS TABLE OF emp_t;
    CREATE TYPE dept_t AS OBJECT
    ( deptno NUMBER
    , deptname VARHCAR2(20)
    , emps nt_emp_t);
    Thks, Matt. (asked same question in XML forum but maybe more appropriate here).
    null

    Matthew,
    Value-based multi-level collections, such as the one you have here, were not supported in 8.1.7. You have two choices:
    1. Upgrade to 9i to take advantage of value-based multi-level collections (see http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a88878/adobjbas.htm#462243), type inheritance, type evolution and other new features.
    2. Use REFs in 8.1.7 to build a reference-based multi-level collections (see http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a76976/adobjdes.htm#446229).
    Regards,
    Geoff

  • JDBC & changed object type in nested table

    Once I add new column in object type in nested table.. I did step by step like it was wrinten in OraDoc..convert data e.t.c
    All programs work fine exept JDBC drivers..I decompile it and it's crashing on oracle.sql.ArrayDescriptor.java in metod
    private int toLengthFromLocator(byte abyte0[])
    after trying to execute this strane query in this method:
    oraclepreparedstatement = (OraclePreparedStatement)m_conn.prepareStatement("SELECT count(*) FROM TABLE( CAST(? AS " + getName() + ") )");
    this method exist and crash in 90 and 92 drivers.. maybe oracleTypeCOLLECTION.java
    public Datum unlinearize(byte abyte0[], long l, Datum datum, long l1, int i, work incorrect.. and cause call of this method..
    2driver developers: please trace your code with changed nested table

    damn... nobody reply me.. but this bug fixed on metalinc..

  • Only oracle object tables to create object oriented database

    Can we use only oracle object tables for a database and if it can be done, can we create pure object oriented database with oracle. How it can be done?
    help..
    thank you..

    PriyashanthaHP wrote:
    I have no my own definitions for OODB. There are lot in the internet. I'm asking, can't we use that OODB concept with oracle. And gave you an example with 'employee' and 'department' tables. I asked that can we create object tables for these two tables keeping their relationship
    thank you..
    There is no way to answer that without knowing what YOU mean by OODB.
    See the database concepts doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28318/schema.htm
    Nested Tables
    You can create a table with a column whose datatype is another table. That is, tables can be nested within other tables as values in a column. The Oracle database server stores nested table data out of line from the rows of the parent table, using a store table that is associated with the nested table column. The parent row contains a unique set identifier value associated with a nested table instance.
      Oracle Database Object-Relational Developer's Guidefor further information on nested tables
      Oracle Database Advanced Application Developer's Guide

  • Adding nested table to object table

    if I alter an object type and add a nested table to it, there seem to be no syntax to add "STORE AS" clause for that nested table in the object table containing the altered object type. E.G.:
    ALTER TYPE fd_dao ADD ATTRIBUTE Own_Name Own_Name_ntt;
    where Own_Name_ntt is a nested table type, then
    ALTER TABLE FD_DOT NESTED TABLE Own_Name STORE AS Own_Name_ntab;
    does not work but the table FD_DOT can not be used since it lacks the storage for the newly added nested table.

    Check your syntax.
    CREATE TYPE Own_Name_ntt AS TABLE OF VARCHAR2(25);
    CREATE TYPE fd_dao AS OBJECT
    (col1        date
    ,col2        number);
    CREATE TABLE fd_dot(cola varchar2(10)
                       ,colb date);
    ALTER TYPE fd_dao ADD ATTRIBUTE Own_Name Own_Name_ntt;
    ALTER TABLE FD_DOT ADD (Own_Name Own_Name_ntt)
        NESTED TABLE Own_Name STORE AS Own_Name_ntab;
    SQL> CREATE TYPE Own_Name_ntt AS TABLE OF VARCHAR2(25);
      2  /
    Type created.
    SQL>
    SQL> CREATE TYPE fd_dao AS OBJECT
      2   (col1        date
      3   ,col2        number);
      4  /
    Type created.
    SQL>
    SQL> CREATE TABLE fd_dot(cola varchar2(10)
      2                     ,colb date);
    Table created.
    SQL>
    SQL> ALTER TYPE fd_dao ADD ATTRIBUTE Own_Name Own_Name_ntt;
    Type altered.
    SQL>
    SQL> ALTER TABLE FD_DOT ADD (Own_Name Own_Name_ntt)
      2      NESTED TABLE Own_Name STORE AS Own_Name_ntab;
    Table altered.
    SQL> desc fd_dot
    Name                                                                          Null?    Type
    COLA                                                                                   VARCHAR2(10)
    COLB                                                                                   DATE
    OWN_NAME                                                                               OWN_NAME_NTT
    SQL> desc fd_dao
    Name                                                                          Null?    Type
    COL1                                                                                   DATE
    COL2                                                                                   NUMBER
    OWN_NAME                                                                               OWN_NAME_NTT
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP and Data Mining options
    SQL> CREATE TYPE Own_Name_ntt AS TABLE OF VARCHAR2(25);
      2  /
    Type created.
    SQL>
    SQL> CREATE TYPE fd_dao AS OBJECT
      2   (col1        date
      3   ,col2        number);
      4  /
    Type created.
    SQL>
    SQL> CREATE TABLE fd_dot(cola varchar2(10)
      2                     ,colb date);
    Table created.
    SQL>
    SQL> ALTER TYPE fd_dao ADD ATTRIBUTE Own_Name Own_Name_ntt;
    Type altered.
    SQL>
    SQL> ALTER TABLE FD_DOT ADD (Own_Name Own_Name_ntt)
      2      NESTED TABLE Own_Name STORE AS Own_Name_ntab;
    Table altered.
    SQL> desc fd_dao
    Name                                                                          Null?    Type
    COL1                                                                                   DATE
    COL2                                                                                   NUMBER
    OWN_NAME                                                                               OWN_NAME_NTT
    SQL> desc fd_dot
    Name                                                                          Null?    Type
    COLA                                                                                   VARCHAR2(10)
    COLB                                                                                   DATE
    OWN_NAME                                                                               OWN_NAME_NTT
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.3.0 - Production

  • Journal tables for Oracle Objects

    Hi.
    How can I create Journal tables for database tables including columns with datatype being a Nested table. I am trying to this in Oracle Designer.
    Thanks.

    Hi,
    check this table <b>TADIR</b> .
    Enter OBJECT = PROG
    and see in SE16.
    follow this link for sample program.
    http://abap4.tripod.com/Upload_and_Download_ABAP_Source_Code.html
    regards,
    Ashok Reddy

Maybe you are looking for

  • How to enter more than one bind variable

    Hello, i use bind-variables to pass parameters from one application to another through links. On the SQL-Query-Tab it says that i can enter more than one bind-variable, but i don't know how to do it. my sql-statement looks like this: SELECT column FR

  • Which file names verify Acrobat Standard 9.3.1 updates are installed?

    Without having to launch the application and look at Help and About, what is a good way to check that 9.3.1 updates are installed? What files would be on a PC with 9.3.1 that would not be on it if it only had 9.3.0?

  • Assigning xml to CDATA in OSB

    Hi! I have a Tuxedo proxy service in Oracle Service Bus. It recieves an XML. First, I want to know how to transform this XML to CDATA to be sent as an argument to an web service operation. And secondly - how to transform the responce in the web servi

  • Newbie wanna know how to use dowloaded pkgs.

    I'm totally a newbie... this is the first time i installed archlinux, and i'm very interested in it... but i got some problems. I hope anyone can help me out ... Due to some  unstable conditions and reasons, the speed of pacman -Sy kde /gnome is very

  • Dynamic Drill Column Fill

    Hi, I have a requirement where in I have to construct a drill down report. The hierarchy is as follows : Club Division Branch Name Initially only Club Name and Transaction count field are displayed on the report which are drillable. When we click on