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

Similar Messages

  • Inserting into a doubly nested table through an object view

    Can anyone give me an example of an INSTEAD OF trigger that will mediate an INSERT into a doubly nested table of an Object View? Is there syntax that will allow it?

    Here's some code to demonstrate. Note that relational tables, not an object table, are used to store object instances:
    create or replace type TInnerNestedTable
    is table of varchar2(20)
    create or replace type TOuterNestedTable
    is table of TInnerNestedTable
    create or replace type TMyObject
    is object
         id     varchar2(20)
    ,     tab     TOuterNestedTable
    create
    table     T_MY_OBJECT
         id          varchar2(20)     not null
    ,     primary key (id)
    create
    table     T_MY_OBJECT_TAB_OUTER
         id          varchar2(20)     not null
    ,     outerIndex     integer          not null
    ,     primary key (id, outerIndex)
    ,     foreign key (id) references T_MY_OBJECT on delete cascade
    create
    table     T_MY_OBJECT_TAB_INNER
         id          varchar2(20)     not null
    ,     outerIndex     integer          not null
    ,     innerIndex     integer          not null
    ,     innerValue     varchar2(20)
    ,     primary key (id, outerIndex, innerIndex)
    ,     foreign key (id, outerIndex) references T_MY_OBJECT_TAB_OUTER on delete cascade
    create or replace view V_MY_OBJECT
    of TMyObject
    with object identifier (id)
    as
    select     t.id
    ,     cast(multiset(
              select     cast(multiset(
                        select     i.innerValue
                        from     T_MY_OBJECT_TAB_INNER i
                        where     i.id = o.id
                        and     i.outerIndex = o.outerIndex
                   ) as TInnerNestedTable)
              from     T_MY_OBJECT_TAB_OUTER o
              where     o.id = t.id
         ) as TOuterNestedTable)
    from     T_MY_OBJECT t
    create or replace trigger TR_II_V_MY_OBJECT
    instead of insert on V_MY_OBJECT
    for each row
    begin
         insert
         into     T_MY_OBJECT
              id
         values     (
              :new.id
         insert
         into     T_MY_OBJECT_TAB_OUTER
              id
         ,     outerIndex
         select     :new.id
         ,     rownum
         from     table(:new.tab) o;
         insert
         into     T_MY_OBJECT_TAB_INNER
              id
         ,     outerIndex
         ,     innerIndex
         ,     innerValue
         select     :new.id
         ,     o.outerIndex
         ,     rownum
         ,     value(i)
         from     (
              select     :new.id
              ,     rownum outerIndex
              ,     value(o) innerTab
              from     table(:new.tab) o
              ) o
         ,     table(o.innerTab) i;
    end;
    insert
    into     V_MY_OBJECT
    values     (
         new TMyObject(
              'A'
         ,     TOuterNestedTable(
                   TInnerNestedTable('A','B','C')
              ,     TInnerNestedTable('AA')
              ,     TInnerNestedTable('AB')
    insert
    into     V_MY_OBJECT
    values     (
         new TMyObject(
              'B'
         ,     TOuterNestedTable(
                   TInnerNestedTable('X','Y','Z')
              ,     TInnerNestedTable('Hello', 'World!')
    /Selecting from the view shows the results:
    select     value(o)
    from     V_MY_OBJECT o
    VALUE(O)(ID, TAB)
    TMYOBJECT('A', TOUTERNESTEDTABLE(TINNERNESTEDTABLE('A', 'B', 'C'), TINNERNESTEDTABLE('AA'), TINNERNESTEDTABLE('AB')))
    TMYOBJECT('B', TOUTERNESTEDTABLE(TINNERNESTEDTABLE('X', 'Y', 'Z'), TINNERNESTEDTABLE('Hello', 'World!')))
    2 rows selected.Hope that helps...
    Gerard

  • Java call stored procedure with nested table type parameter?

    Hi experts!
    I need to call stored procedure that contains nested table type parameter, but I don't know how to handle it.
    The following is my pl/sql code:
    create or replace package test_package as
    type row_abc is record(
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    type matrix_abc is table of row_abc index by binary_integer;
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    END test_package;
    create or replace package body test_package as
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    IS
    v_sn NUMBER(8):=0 ;
    BEGIN
    LOOP
    EXIT WHEN v_sn>5 ;
    v_sn := v_sn + 1;
    p_out(v_sn).col1 := 'col1_'||to_char(v_sn)|| p_arg1 ;
    p_out(v_sn).col2 := 'col2_'||to_char(v_sn)||p_arg2 ;
    p_out(v_sn).col3 := 'col3_'||to_char(v_sn)||p_arg3 ;
    END LOOP ;
    END ;
    END test_package ;
    My java code is following, it doesn't work:
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection
    ("jdbc:oracle:thin:@10.16.102.176:1540:dev", "scott", "tiger");
    con.setAutoCommit(false);
    CallableStatement ps = null;
    String sql = " begin test_package.test_matrix( ?, ? , ? , ? ); end ; ";
    ps = con.prepareCall(sql);
    ps.setString(1,"p1");
    ps.setString(2,"p2");
    ps.setString(3,"p3");
    ps.registerOutParameter(4,OracleTypes.CURSOR);
    ps.execute();
    ResultSet rset = (ResultSet) ps.getObject(1);
    error message :
    PLS-00306: wrong number or types of arguments in call to 'TEST_MATRIX'
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored
    Regards
    Louis

    Louis,
    If I'm not mistaken, record types are not allowed. However, you can use object types instead. However, they must be database types. In other words, something like:
    create or replace type ROW_ABC as object (
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    create or replace type MATRIX_ABC as table of ROW_ABC
    /Then you can use the "ARRAY" and "STRUCT" (SQL) types in your java code. If I remember correctly, I recently answered a similar question either in this forum, or at JavaRanch -- but I'm too lazy to look for it now. Do a search for the terms "ARRAY" and "STRUCT".
    For your information, there are also code samples of how to do this on the OTN Web site.
    Good Luck,
    Avi.

  • How to use nested table types with XDK

    Im using Oracles XDK (xml development kit) to create xml-documents from data in database.4
    Problem: I need to use nested tables but when trying to create nested table types I get error: A Table type may not contain a nested table type or VARRAY.
    Hope I make myself clear! Are there any solutions or workarounds to this problem?
    Help appreciated, thanks!

    Jesper,
    I asked similar question last year (search for Tapsell, you will see my posting). Under 8.1.7 the "nesting" seems restricted to one level down. Thus you cannot create a type using another object that itself includes a nested table. Under Oracle 9, against which most current examples seem based, this limitation is removed making things easier. Under 8.1.7 the workaround I have used is to use the CAST syntax. This is not as neat, but it works.

  • View of values in nested table attribute of object type

    Hi,
    I have:create or replace type ctx_line is object (
      ctx_name  varchar2(40),
      ctx_value varchar2(1000)
    create or replace type ctx_tab is table of ctx_line;
    create type tp as object (
      id      number,
      ctx     ctx_tab
    create table tt of tp nested table ctx store as ctx_nesttab;
    create or replace view v as
    SELECT VALUE(o).id as id
      FROM tt o;Now I want to create an another view containing fields ctx_name, ctx_value and a key (maybe NESTED_TABLE_ID?) to the parent record in tt table. I must be able to join that view to each other. This is necessary because I will use that views in Forms 4.5 (which do not support nested tables).
    Can someone help me, please?

    I'm not sure what you are looking for exactly but is it something like this?
    SELECT id
         , p.ctx_name
         , p.ctx_value
    FROM   tt
         , TABLE(ctx) pWith the following test data:
    INSERT INTO tt VALUES(1,CTX_TAB(CTX_LINE('A','SOME VALUE1')));
    INSERT INTO tt VALUES(1,CTX_TAB(CTX_LINE('B','SOME VALUE2')));
    INSERT INTO tt VALUES(1,CTX_TAB(CTX_LINE('B','SOME VALUE2')));this is the result:
    SQL> SELECT id
      2       , p.ctx_name
      3       , p.ctx_value
      4  FROM   tt
      5       , TABLE(ctx) p
      6  /
            ID CTX_NAME                                 CTX_VALUE
             1 A                                        SOME VALUE1
             1 B                                        SOME VALUE2
             1 B                                        SOME VALUE2

  • Building an object of nested table types

    Hi,
    Looking for suggestions for the following.
    I have a procedure with 4 table types.
    They are in a hierarchical order so that 4 is the child of 3, 3 is the child of 2 and 2 is the child of 1.
    One of the columns of table 1 is a table type holding all the child records from table 2,
    One of the columns of table 2 is a table type holding all the child records from table 3,
    One of the columns of table 3 is a table type holding all the child records from table 4,
    I have 4 cursors that pull out all of the data to populate each of my 4 table types.
    I am trying to figure out how to nest my fetches to populate all of my table types to create a single object that hold all of my data.
    It’s a table of a table of a table of a table.
    Column 3 of table 1 holds table 2
    Column 3 of table 2 holds table 3
    Column 3 of table 3 holds table 4
    I’ve tried creating my procedure like this (pseudo code)
    declare
    tab_1 tab_1_type;
    tab_2 tab_2_type;
    tab_3 tab_3_type;
    tab_4 tab_4_type;
    cursor get_tab_1 is
    select col1, col2, tab_2 – added the table type for the child records
    from data_table_1
    cursor get_tab_2(tab_1_pk in number) is
    select col1, col2, tab_3 – added the table type for the child records
    from data_table_2
    where tab_2_fk = tab_1_pk
    cursor get_tab_3(tab_2_pk in number) is
    select col1, col2, tab_4 – added the table type for the child records
    from data_table_3
    where tab_3_fk = tab_2_pk
    cursor get_tab_4(tab_3_pk in number) is
    select col1, col2, col3
    from data_table_4
    where tab_4_fk = tab_3_pk
    begin
    open get_tab_1;
    loop
    open get_tab_2
    loop
    open get_tab_3
    loop
    open get_tab_4(tab_3_pk);
    bulk collect get_tab_4 into tab_4;
    close get_tab_4;
    fetch get_tab_3 into tab_3;
    tab_4:= null;
    exit when get_tab_3 %notfound;
    end loop;
    close get_tab_3;
    fetch get_tab_2 into tab_2;
    tab_3:= null;
    exit when get_tab_2 %notfound;
    end loop;
    close get_tab_2;
    fetch get_tab_1 into tab_1;
    tab_3:= null;
    exit when get_tab_1 %notfound;
    end loop;
    close get_tab_1;
    l_return := tab_1;
    end;
    The above won’t work because once the cursor is opened the child tables will be assigned values of null before they have had a chance to populate from the nested fetches.
    It’s almost as if I need to execute the fetch and update the extra columns afterwards somehow, something like:
    fetch get_tab_3 into tab_3;
    tab_3.col3 := tab_4;
    tab_4 := null;
    end loop;
    close get_tab_3;
    can I do that?
    Also the above seems very cumbersome. If there is a more elegant way of building up this object I’d like to hear it.
    Cheers
    Yog

    Interesting little exercise getting a 3 deep nested structure using a single SQL. Below is my attempt. You should be able to run it in any schema that has CREATE TYPE privs.
    SQL> -- Nested structure design:
    SQL> --
    SQL> -- USER LIST = (
    SQL> -- (USER1,OBJECT_LIST1).., (USERn,OBJECT_LISTn)
    SQL> -- )
    SQL> --
    SQL> -- LIST OF OBJECTS = (
    SQL> -- (TYPE1, NAME_LIST1).., (TYPEn, NAME_LISTn)
    SQL> -- )
    SQL> --
    SQL> -- LIST OF NAMES = ( NAME1..,NAMEn )
    SQL>
    SQL>
    SQL> create or replace type TObjectList is table of varchar2(50)
    2 /
    Type created.
    SQL>
    SQL> create or replace type TObjType is object(
    2 obj_type varchar2(50),
    3 obj_list TObjectList
    4 );
    5 /
    Type created.
    SQL>
    SQL> create or replace type TObjTypeList is table of TObjType;
    2 /
    Type created.
    SQL>
    SQL> create or replace type TUser is object(
    2 user_name varchar2(50),
    3 objects TObjTypeList
    4 );
    5 /
    Type created.
    SQL>
    SQL> create or replace type TUserList is table of TUser;
    2 /
    Type created.
    SQL>
    SQL> col NESTED_STRUCTURE format a100
    SQL>
    SQL> -- constructing the above user list (have made the start of the USER bold in the output below)
    SQL> select
    2 CAST( COLLECT(
    3 TUser(
    4 username,
    5 CAST( MULTISET(
    6 select
    7 TObjType(
    8 object_type,
    9 CAST( COLLECT(o.object_name) as TObjectList)
    10 )
    11 from all_objects o
    12 where o.owner = u.username
    13 group by
    14 o.object_type
    15 ) as TObjTypeList
    16 )
    17 )
    18 ) as TUserList
    19 ) as NESTED_STRUCTURE
    20 from all_users u
    21 where u.username in ('BILLY','DBSNMP')
    22 /
    NESTED_STRUCTURE(USER_NAME, OBJECTS(OBJ_TYPE, OBJ_LIST))
    TUSERLIST(TUSER('BILLY', TOBJTYPELIST(TOBJTYPE('FUNCTION', TOBJECTLIST('GETEMP', 'GETEMP2', 'TESTRET
    URN', 'WTF', 'ANOOP_REF')), TOBJTYPE('INDEX', TOBJECTLIST('PK_DEPT', 'PK_EMP')), TOBJTYPE('PROCEDURE
    ', TOBJECTLIST('USESEQ1', 'FOOPROC', 'W')), TOBJTYPE('TABLE', TOBJECTLIST('X', 'LOAD_TABLE', 'DEPT',
    'EMP', 'BONUS', 'SALGRADE')), TOBJTYPE('TYPE', TOBJECTLIST('TEMP', 'TEMPLOYEE', 'TX', 'TARRAY2D', '
    TARRAY1D', 'TARRAY3D', 'TOBJECT', 'TOBJTYPE', 'TOBJECTLIST', 'TOBJTYPELIST', 'TUSER', 'TUSERLIST', '
    SYSTPTkQoC5hBR+DgQPsKOl0PFQ==', 'SYSTPTkQoC5hyR+DgQPsKOl0PFQ==', 'SYSTPTkQoC5qzR+DgQPsKOl0PFQ==', 'S
    YSTPTkQoC5raR+DgQPsKOl0PFQ==')))), TUSER('DBSNMP', TOBJTYPELIST(TOBJTYPE('INDEX', TOBJECTLIST('MGMT_
    DB_FILE_GTT_PK', 'MGMT_DB_SIZE_GTT_PK')), TOBJTYPE('PACKAGE', TOBJECTLIST('MGMT_RESPONSE')), TOBJTYP
    E('PACKAGE BODY', TOBJECTLIST('MGMT_RESPONSE')), TOBJTYPE('SEQUENCE', TOBJECTLIST('MGMT_RESPONSE_CAP
    TURE_ID', 'MGMT_RESPONSE_SNAPSHOT_ID')), TOBJTYPE('TABLE', TOBJECTLIST('MGMT_SNAPSHOT', 'MGMT_SNAPSH
    OT_SQL', 'MGMT_BASELINE', 'MGMT_BASELINE_SQL', 'MGMT_CAPTURE', 'MGMT_CAPTURE_SQL', 'MGMT_RESPONSE_CO
    NFIG', 'MGMT_LATEST', 'MGMT_LATEST_SQL', 'MGMT_HISTORY', 'MGMT_HISTORY_SQL', 'MGMT_TEMPT_SQL', 'MGMT
    DBFILE_GTT', 'MGMT_DB_SIZE_GTT')), TOBJTYPE('VIEW', TOBJECTLIST('MGMT_RESPONSE_BASELINE')))))
    SQL>
    PS. To understand how the SQL works, run it from the inside out - i.e. run the innermost select on its own to see the output and then add to it until the full select is reached.

  • Require help on Array of Nested tables and Oracle Object type

    Hi All,
    I have a scenario where I have some millions of records received from a flat file and the record is stored in Table as below:
    Tablename: FILE_RECORD
    Rows:
    FILE_REG_ID = 1
    RECORD_NBR = 1     
    PROCESSED_IND = U
    RECORD= 00120130326006A
    FILE_REG_ID = 1
    RECORD_NBR = 2     
    PROCESSED_IND = U
    RECORD= 00120130326003
    1) I have to read these records at once and
    a) Split the RECORD column to get various other data Eg: Fld1=001, Fld2=20130326, Fld3 = 003
    b) send as an Array to Java.
    2) Java will format this into XML and sent to other application.
    3) The other application returns a response as Successful or Failure to Java in XML
    4) Java will send RECORD_NBR and the corresponding response as Success or Failure back to PLSQL
    5) PLSQL should match the RECORD_NBR and update the PROCESSED_IND = P.
    I 'm able to achieve this using SQL Table type by creating a TYPE for Each of the fields (Flds) however the problem is Java cannot Access the parameters as the TYPE are of COLUMN Types
    Eg: For RECORD_NBR
    SUBTYPE t_record_nbr IS FILE_RECORD.T010_RECORD_NBR%TYPE;
    Can you please let me know how I can achieve this to support Java, I know one way that is by creating an OBJECT TYPE and a TABLE of the OBJECT TYPE.
    Eg: T_FILE_RECORD_REC IS OBJECT
    FILE_REG_ID number(8), RECORD_NBR number (10), PROCESSED_IND varchar2(1), RECORD varchar(20)
    Create type T_FILE_RECORD_TAB IS TABLE OF T_FILE_RECORD_REC
    However I'm facing a problem to populate an Array of records, I know I'm missing something important. Hence please help.
    It would be helpful to provide some guidelines and suggestions or Pseudo or a Code to achieve this. Rest all I can take up further.
    Thanks in advance,

    I know once way that is creating a OBJECT TYPE and a TABLE of OBJECT TYPE, howeve I feel I'm missing something to achieve this.You're right, you need SQL object types created at the database level. Java doesn't know about locally defined PL/SQL types
    However you can do without all this by creating the XML directly in PL/SQL (steps 1+2) and passing the document to Java as XMLType or CLOB.
    Are you processing the records one at a time?

  • How to represent Nested table as variable/Object in OCI

    Hi All,
    I'm new to OCI.
    I've following nested table in my database.
    Nested table:
    create type type1 as object (name varchar2(20));
    create type type2 as table of type1;
    create table table1 (col1 varchar2(20), col2 type2) nested table col2 store as table2;
    Can anyone help me to present col2 as C structure/typedef so as to use it with OCIDefineObject?

    You can have a look at Chapter 11 of the OCI Programmer's Guide. Look at the section Collections in it. You can represent the nested table as OCITable *. Further, you can generate structure representation of your object type by using OTT. Please let us know if this answers your question. In case you are not able to proceed please let us know.
    Thanks,
    Sumit

  • HELP! Applying a varray to a relational table via an object view

    Hi
    I could really do with some help on this one its drivin me nuts!
    I'm trying to create an object view for the following table using the following ADTs and a Varray:
    R_CUSTOMER
    CUSTID NUMBER
    LNAME VARCHAR2(25)
    FNAME VARCHAR2(25)
    STREET VARCHAR2(30)
    TOWN VARCHAR2(25)
    COUNTY VARCHAR2(25)
    PCODE CHAR(9)
    DPHONE CHAR(15)
    EPHONE CHAR(15)
    MPHONE CHAR(15)
    PERSON_TY
    LNAME VARCHAR2(25)
    FNAME VARCHAR2(25)
    ADDRESS ADDRESS_TY
    PHONES PHONE_VA
    ADDRESS_TY
    STREET VARCHAR2(50)
    TOWN VARCHAR2(25)
    COUNTY VARCHAR2(25)
    PCODE CHAR(9)
    create or replace type PHONE_VA as varray(4) of VARCHAR2(15)
    But can the procedure required to select data from the varray be included in the view. I've tried all sorts but i just can't get it to work.
    Can this be done? if so how
    Thks
    null

    Matthew,
    Yes, this can be done with the cast-multiset operator. Please see my answer to your earlier posting.
    Regards,
    Geoff

  • MetaData for nested table type

    in a nested table a column is of datatype "TYPE"
    so how can i get metadata for this column..
    if "OPTIONS" is a column of datatype "TYPE"
    and it has 2 columns option_id and option_value
    then when i'am trying to get
    array.getBaseTypeName
    m gettin TAB_TY_OPTION_DETAILS
    like this only..
    how can i get metadata for this datatype.
    Thanks in advance.

    check out ResultSetMetaData

  • How do I update a Nested Table of inherited Object Types?

    Does anyone know why the following line (commented out) doesn't work and what I can do? Is there some way to cast the column I am trying to update? I think I am going crazy....
    create or replace type person_ot as object (name varchar2(10)) not final;
    create or replace type student_ot under person_ot (s_num number) not final;
    create type person_tt as table of person_ot;
    declare
    lv_person_list person_tt;
    lv_sql varchar2(1000);
    ref_cur sys_refcursor;
    begin
    lv_sql:= 'select new student_ot(''fred'', 100) from dual
    union all
    select new student_ot(''sally'', 200) from dual';
    open ref_cur for lv_sql;
    fetch ref_cur bulk collect into lv_person_list;
    close ref_cur;
    dbms_output.put_line(lv_person_list.count);
    for i in lv_person_list.first..lv_person_list.last loop
    lv_person_list(i).name := initcap(lv_person_list(i).name ); -- This works!
    lv_person_list(i).s_num := 9999;  Why doesn't this line work and how can I update the column s_num ??? :-(
    end loop;
    end;
    /

    Hi Tubby - You are right...It would make sense to create the Type as type of student_ot. Only problem is I am trying to keep it generic. I will include full listing to show what I am doing...
    create or replace type person_ot as object (name varchar2(10)) not final;
    create or replace type student_ot under person_ot (s_num number) not final;
    create type person_tt as table of person_ot;
    create table persons of person_ot;
    declare
    lv_person_list person_tt;
    lv_sql varchar2(1000);
    ref_cur sys_refcursor;
    begin
    lv_sql:= 'select new student_ot(''fred'', 100) from dual
    union all
    select new student_ot(''sally'', 200) from dual';
    open ref_cur for lv_sql;
    fetch ref_cur bulk collect into lv_person_list;
    close ref_cur;
    for i in lv_person_list.first..lv_person_list.last loop
    lv_person_list(i).name := initcap(lv_person_list(i).name );
    lv_person_list(i).s_num := 9999;*                             Why doesn't this line work?? :-(
    end loop;
    forall i in lv_person_list.first..lv_person_list.last
    insert into persons values lv_person_list(i);
    end;
    /

  • No support for date type in object views !?

    The very simple example below raises
    SQL Error: ORA-00932: types de données incohérents ; attendu : DATE ; obtenu : DATE
    Occurs on XE and 10.2.0.3 on HP-UX
    Any clue?
    Thanks,
    Robert
    create type t1 as object (id number, time date)
    create view t1v of t1
    with object identifier (id)
    as select 1, sysdate from dual
    ;

    There is no need for a constructor when all attributes are assigned.Unless there is a date value, apparently ;)
    It also works if you explicitly <tt>CAST(SYSDATE AS DATE)</tt> so perhaps the internal limitation is to do with the two internal DATE types (type 12 and 13, if you check DUMP output).

  • How to call nested table type from Java

    I needed a 2 dimensional array and asked the questuion here.
    [Original thread| http://forums.oracle.com/forums/message.jspa?messageID=3419944#3419944]
    I have my program working correctly in pl/sql.
    The java guys are building this array and passing it in to me, but they don't know how.
    A small example of this would be appreciated.
    Heres an example of the procedure prototype and the type definitions in use
    create or replace
    type csn_array_obj
    as object
    (csn varchar2(20 char),
    box_id varchar2(10)
    create or replace
    type csn_array_type is table of csn_array_obj;
    procedure populate_stock(
    p_csn_array in csn_array_type
    added in example of object and type definition.

    There's an orl Oramag article by Tom Kyte rounding up [some Java tips|http://asktom.oracle.com/tkyte/omag/00-nov/o60tom.html] which includes an example of how to do this. You'll need to replace Tom's SIMPLARRAY with your own type.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • How to assign values into nested table type in plsql

    hi all,
    I feel some what difficult to return user defined types from plsql function and procedures .
    Can any one help me to learn this .
    Version details are as follow
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL>
    create or replace type emp_names_nt is table of varchar2(100);
    /* Formatted on 2012/04/05 15:23 (Formatter Plus v4.8.8) */
    CREATE OR REPLACE FUNCTION get_emp_names
       RETURN emp_names_nt
    IS
       CURSOR ec
       IS
          SELECT ename
            FROM emp;
       v_emp_names   emp_names_nt := emp_names_nt ();
    BEGIN
       FOR i IN ec
       LOOP
          v_emp_names.EXTEND ();
          v_emp_names (i) := i.ename;
       END LOOP;
       RETURN v_emp_names;
    END;
    Error :
    PL/SQL: Statement ignored
    PLS-00382: expression is of wrong typeThanks in advance .............
    Thanks,
    P Prakash

    CREATE OR REPLACE FUNCTION get_emp_names
       RETURN emp_names_nt
    IS
       CURSOR ec
       IS
          SELECT ename
            FROM scott.emp;
       v_emp_names   emp_names_nt := emp_names_nt();
       cnt  number:=1;
    BEGIN
       FOR i IN ec
       LOOP
          v_emp_names.EXTEND;
          v_emp_names(cnt) := i.ename;
          cnt:=cnt+1;
       END LOOP;
       RETURN v_emp_names;
    END;
    show errors

  • Newbie: Nested table type problem

    << accidently posted the quiery twice >>
    Message was edited by:
    user575882

    Ooooops....sorry that i posted this thread twice....
    I actually gave me an error...
    Now how to delete it???

Maybe you are looking for

  • Sending IDOCs from SAP R/3 to XI

    I have ALE set up to send an IDOC on every Material master change or create. This works fine so far - only after creation I do not receive the IDOC on my XI system's IDOC Adapter. In the Transactional RFCs (sm58) I can see the following error message

  • How to i get an ibook into itunes

    How do I get a book i purchased from ibooks to go into itunes?

  • A new HD TV, that will work in the building I live in

    I live in a tower structure apt building, on the 6th floor facing south. No dishes are allowed, there's no place to put em and it's in the lease. So, all I can get is Comcast cable, for TV. I could use rabbit ears, but I don't think that will give me

  • Is there a way to get Shells by Z-Order?

    If there are more than one Shell for a Display, some Shells could cover others, I want to get all Shells by Z-Order: Top first. Is there a way? Thanks. Frank

  • Using JARX API to register a Web service in IBM UDDI Business Registry

    HI. I have a code, which uses the JAXR API to register a web service to the IBM UDDI Business Registry Version 2.0. I compiled the code using the ant tool. When running the code, i get a java.security.PrivilegedActionException exception. i am using a