Nested Table Problem

Hello,
I am using Oracle10g and TopLink 10.1. I would like to implement a table descriptor which has nested tables.
When I try to read "root" table, I get error messages described below.
Could anybody tell me what's wrong?
Thanks,
***** [3 Tables] *****
Table: PARENT
Fields: PARENT_NO
Table: CHILD
Fields: CHILD_NO, PARENT_NO
Table: CHILD_MASTER
Fields: CHILD_NO, CHILD_NAME, etc.
***** [The relation between tables] *****
Parent<---(OneToMany)--->Child<---(Multitable)--->ChildMaster
*****   *****[/b]
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(Parent.class);
descriptor.setTableName("PARENT");
descriptor.setPrimaryKeyFieldName("PARENT_NO");
descriptor.addTableName("CHILD");
descriptor.addTableName("CHILD_MASTER");
// OneToMany configuration
OneToManyMapping oneToMany = new OneToManyMapping();
oneToMany.setAttributeName("Child");
oneToMany.setReferenceClass(Child.class);
oneToMany.setTargetForeignKeyFieldName("PARENT_NO");
descriptor.addMapping(oneToMany);
// Multitable configuration
ExpressionBuilder builder = new ExpressionBuilder();
Expression exp = builder.getField("CHILD.CHILD_NO").equal("CHILD_MASTER.CHILD_NO");
descriptor.getDescriptorQueryManager().setMultipleTableJoinExpression(exp);
// Read
ReadObjectQuery query = new ReadObjectQuery("PARENT");
UnitOfWork uow = toplinkSession.acquireUnitOfWork();
uow.executeQuery(query);
***** [Resulting SQL] *****
SELECT t0.PARENT_NO, t1.PARENT_NO, t2.PARENT_NO,...
FROM PARENT t0, CHILD t1, CHILD_MASTER t2
WHERE ((t1.PARENT_NO = t0.PARENT_NO) AND (t1.CHILD_NO = t2.CHILD_NO))
***** [Error Message] *****
When I read "Parent",  I get following error...
"T2" is "CHILD_MASTER" table which has no "PARENT_NO" field. I don't want select "CHILD_MASTER.PARENT_NO" because it doesn't exist!
Exception[TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070620)): oracle.toplink.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-00904: "T2"."PARENT_NO": Invalid Identifier
Error Code: 904
Query:ReadAllQuery(Parent)
     at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:290)
     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:581)
     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:441)
Message was edited by:
        user601162                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Thank you for your reply. Maybe my explanation was confusing.
>Parent should map to the PARENT table,
Child should map the CHILD
and ChildMaster should map to the CHILD_MASTER table.
Exactly. What I want to do is "Parent has Child" using OneToMay, "Child has ChildMaster" using Multitable. I guess it's still unclear...
Anyway, I appreciate your advice.

Similar Messages

  • Update Nested Table Problem

    Hi All,
    I have a update problem in nested table.
    Below is my query:
    CREATE OR REPLACE TYPE TRACER.SEARCH_DATA AS TABLE OF VARCHAR2(20);
    UPDATE TRACER_SEARCH_SCHEDULE_LOT_NUM
    SET NOT_FOUND_SOR_LOT_NUM = SEARCH_DATA(
    SELECT
    COLUMN_VALUE
    FROM
    TABLE (SELECT SORTING_LOT_NUMBER FROM TRACER_SEARCH_SCHEDULE_LOT_NUM WHERE JOB_ID = 8)
    WHERE
    TRIM(COLUMN_VALUE) NOT IN (SELECT DISTINCT (SORTING_LOT_NUMBER) FROM SEARCH_SCHEDULE_RESULT_LOT_NUM WHERE JOB_ID = 8)
    ) WHERE JOB_ID = 8;
    ORA-00936: missing expression
    or I try as following
    DECLARE
    sor_lot_num_not_found SEARCH_DATA :=
    SEARCH_DATA
    SELECT
    FROM
    TABLE (SELECT SORTING_LOT_NUMBER FROM TRACER_SEARCH_SCHEDULE_LOT_NUM WHERE JOB_ID = 8)
    WHERE
    TRIM(COLUMN_VALUE) NOT IN (SELECT DISTINCT (SORTING_LOT_NUMBER) FROM SEARCH_SCHEDULE_RESULT_LOT_NUM WHERE JOB_ID = 8)
    BEGIN
    UPDATE TRACER_SEARCH_SCHEDULE_LOT_NUM SET NOT_FOUND_SOR_LOT_NUM = sor_lot_num_not_found WHERE JOB_ID = 8;
    END;
    ORA-06550: line 5, column 9:
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( ) - + case mod new not null others <an identifier>
    table avg count current exists max min prior sql stddev sum
    variance execute multiset the both leading trailing forall
    merge year month DAY_ hour minute second timezone_hour
    timezone_minute timezone_region timezone_abbr time timestamp
    interval date
    <a string literal with character set specificat
    ORA-06550: line 11, column 5:
    PLS-00103: Encountered the symbol ")" when expecting one of the following:
    ; for and or group having intersect minus order start union
    where connect
    ORA-06550: line 14, column 4:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted d
    I have try on the Select Statement, it work. So is it the way that I assign data from nested table and update method is wrong?
    Edited by: skymonster84 on Mar 8, 2011 5:12 PM

    Hi,
    I think MULTISET operators might interest you.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/operators006.htm
    Not tested :
    UPDATE tracer_search_schedule_lot_num
    SET not_found_sor_lot_num =
          sorting_lot_number
          MULTISET EXCEPT ALL
          CAST(
            MULTISET(
              SELECT distinct sorting_lot_number
              FROM search_schedule_result_lot_num
              WHERE job_id = 8
            AS search_data
    WHERE job_id = 8
    ;

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

  • Problem when expanding Tree - Tree with nested table column

    Hi, i have created the tree using the Tree with nested table column.
    I have created a node called TREE_ROOT in the context.
    This node has few attributes which includes children_loaded, is_leaf, is_expanded.
    I have created the recursive node TREE_SUB for the above node TREE_ROOT.
    In the view, i have created the table with the master column. The above attributes have been mapped accordingly. I have created the action handler for load_children.
    In this action handler method, i receive the context_element correctly. In this method, i determine the children of the selected element and the resulting children are attached to this context_element.
    But the problem is: when i add elements to context_elements in the method load_children, these
    elements get added to the node TREE_ROOT as well.
    Please help.
    thanks and best regards,
    Pramod

    I just use some types defined in this user... Well, I hope you know what is the type definition of d_period_sec,
    don't you ? I didn't ask to provide all types existed now, only types you are
    using.
    Anyhow you have been granted with execute privilege for types you are using:
    SQL> conn tau_tll/tau_tll;
    Connected.
    SQL> create or replace type d_period_sec as object (date# date);
      2  /
    Type created.
    SQL> grant execute on d_period_sec to public with grant option;
    Grant succeeded.
    SQL> conn scott/tiger
    Connected.
    SQL> CREATE OR REPLACE TYPE unit_function AS OBJECT (
      2  xi NUMBER,
      3  yi NUMBER,
      4  xe NUMBER,
      5  ye NUMBER,
      6  xm NUMBER,
      7  ym NUMBER,
      8  v NUMBER,
      9  a NUMBER,
    10  f NUMBER,
    11  descr VARCHAR2 (20)
    12  );
    13  /
    Type created.
    SQL> grant execute on unit_function to master;
    Grant succeeded.
    SQL> CREATE OR REPLACE TYPE unit_moving_point AS OBJECT
      2  (
      3  p tau_tll.d_period_sec, -- from user TAU_TLL
      4 
      5  m unit_function
      6  )
      7  /
    Type created.
    SQL> grant execute on unit_moving_point to master;
    Grant succeeded.
    SQL> CREATE OR REPLACE TYPE moving_point_tab AS TABLE OF unit_moving_point;
      2  /
    Type created.
    SQL> grant execute on moving_point_tab to master;
    Grant succeeded.
    SQL> CREATE OR REPLACE TYPE moving_point AS OBJECT (u_tab moving_point_tab);
      2  /
    Type created.
    SQL> grant execute on moving_point to master;
    Grant succeeded.
    SQL> conn master/master
    Connected.
    SQL> CREATE TABLE MPOINTS (
      2  id NUMBER,
      3  mpoint scott.Moving_Point)
      4  NESTED TABLE mpoint.u_tab store as moving_tab;
    Table created.Rgds.

  • Problem with Nested Table

    I am trying to make a nested table receive an arbitrary number of values (from a shuttle) through a loop, and then insert the table into a table of nested table in my database. The problem I am having is that when I try to insert more than one value into the nested table, it will only insert the last item in the loop into the database. Thanks in advance.
    This is the code I used to create my objects:
    create or replace type OUTPUT_TY as object( ATTRIBUTE_ID Number(8) )
    create or replace type OUTPUTS_NT as table of OUTPUT_TY
    This is my actual code in ApEx:
    declare
    temp_NT OUTPUTS_NT;
    temp_TY OUTPUT_TY;
    temp Number(10);
    l_vc_arr2 htmldb_application_global.vc_arr2;
    begin
    temp_nt := outputs_nt();
    l_vc_arr2 := HTMLDB_UTIL.string_to_table (:P2_SHUTTLE, ':');
    FOR i IN 1 .. l_vc_arr2.COUNT
    LOOP
    temp_ty := output_ty(l_vc_arr2(i)) ;
    temp_NT:= outputs_nt(temp_ty);
    END LOOP;
    INSERT INTO OUTPUT_TEST values (temp_NT);
    commit;
    end;

    > temp_NT:= outputs_nt (temp_ty);You are not extending the nested table / collection, you are simply assigning an entirely new collection to it for each element of l_vc_arr2.
    Try something like...
    FOR i IN 1 .. l_vc_arr2.COUNT LOOP
       temp_ty := output_ty (l_vc_arr2 (i));
       temp_nt.EXTEND;
       temp_nt (temp_nt.LAST) := temp_ty;
    END LOOP;Or perhaps more succintly...
    FOR i IN 1 .. l_vc_arr2.COUNT LOOP
       temp_nt.EXTEND;
       temp_nt (temp_nt.LAST) := output_ty (l_vc_arr2 (i));
    END LOOP;

  • Public Synonyms for Nested Tables - Insertion Problem

    Hi,
    we are facing a problem during implementation. Our DB set up
    is , we will be having two schema named OWNR and COPY.
    In the schema, OWNR we have to create all the tables,
    types,procedures, packages and obj.....This schema will have
    both DDL and DML privileges.
    In the schema, COPY we are not supposed to create any tables,
    objects. We have to create public synonyms for all the tables,
    types, procedures... in OWNR and grant ALL privilege to the
    schema COPY.The schema, COPY will have only DML privileges.
    The problem is we have some nested tables in our application.
    When I try to insert into the synonym which is created for the
    nested table, it is not allowing me to insert..The whole
    implementation is stucked..Please help.The scripts are given
    below.......
    We have a type name SITA_ADDRESS_TY which is used by the nested
    table SITA_ADDRESSES_NT.Script used for creating the Type,Nested
    table,Table, Public Synonym and granting all privilege to these
    types and tables are
    CREATE OR REPLACE TYPE SITA_ADDRESS_TY AS OBJECT (
    SITA_ADDRESS VARCHAR2(10),
    REMARKS VARCHAR2(100)) ;
    PROMPT SITA_ADDRESSS_NT...
    CREATE OR REPLACE TYPE SITA_ADDRESSES_NT AS TABLE OF
    SITA_ADDRESS_TY ;
    Using this nested table we have created the table,
    UMS_SITA_ADDRESS
    CREATE TABLE UMS_SITA_ADDRESS (
    COMPANY_CODE VARCHAR2 (6) NOT NULL,
    AIRLINE_CODE VARCHAR2 (6) NOT NULL,
    DESTINATION VARCHAR2 (6) NOT NULL,
    SITA_ADDRESS SITA_ADDRESSES_NT)
    TABLESPACE EKUMDAT
    PCTFREE 5
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 64K
    PCTINCREASE 0
    MINEXTENTS 1
    MAXEXTENTS 505
    FREELISTS 1 FREELIST GROUPS 1 )
    NOCACHE
    NESTED TABLE SITA_ADDRESS STORE AS UMSNT_SITA_ADDRESS ;
    PROMPT SYNONYM SITA_ADDRESS_TY...
    CREATE PUBLIC SYNONYM SITA_ADDRESS_TY FOR SITA_ADDRESS_TY
    PROMPT SYNONYM SITA_ADDRESSES_NT...
    CREATE PUBLIC SYNONYM SITA_ADDRESSES_NT FOR SITA_ADDRESSES_NT
    PROMPT UMS_SITA_ADDRESS...
    CREATE PUBLIC SYNONYM UMS_SITA_ADDRESS FOR UMS_SITA_ADDRESS
    Granting Privileges
    PROMPT SITA_ADDRESS_TY...
    GRANT EXECUTE ON SITA_ADDRESS_TY TO COPY
    PROMPT SITA_ADDRESSS_NT...
    GRANT EXECUTE ON SITA_ADDRESSES_NT TO COPY
    PROMPT UMS_SITA_ADDRESS...
    GRANT ALL ON UMS_SITA_ADDRESS TO COPY
    When I connect to copy and desc UMS_SITA_ADDRESS, the structure
    is
    SQL> desc ums_sita_address
    Name Null? Type
    COMPANY_CODE NOT NULL VARCHAR2(6)
    AIRLINE_CODE NOT NULL VARCHAR2(6)
    DESTINATION NOT NULL VARCHAR2(6)
    SITA_ADDRESS
    OWNR.SITA_ADDRESSES_NT
    Why is it so??. Even though I have a synonym for
    SITA_ADDRESSES_NT, it is not referencing the synonym but instead
    refer the OWNR.SITA_ADDRESSES_NT
    Because of this when I try to insert into ums_sita_address(in
    schema COPY), it is giving the following error,
    SQL> insert into ums_sita_address values
    ('EK','EK','DXB',SITA_ADDRESSES_NT());
    insert into ums_sita_address values
    ('EK','EK','DXB',SITA_ADDRESSES_NT())
    ERROR at line 1:
    ORA-00932: inconsistent datatypes
    But when the same connect to OWNR and try to insert with the
    same stmt, it is inserting...
    Our middle tier can connect only to COPY schema alone..Is there
    anything to be done in the DBA side to achieve this??.
    Please help from your valuabe experience...Or can you ask your
    collegues if they have got a soln to this probs..Our
    implementation team is stucked with this...
    Thanks
    Priya

    Hi
    I am not sure but maybe you need to use this command:
    SQL> insert into ums_sita_address values
    ('EK','EK','DXB',SITA_ADDRESSES_TY());
    SITA_ADDRESSES_TY() instead SITA_ADDRESSES_NT
    Regards

  • Public Synonyms for Nested Tables - Insertion Problem  - Please Help!!!!!

    Hi,
    we are facing a problem during implementation. Our DB set up
    is , we will be having two schema named OWNR and COPY.
    In the schema, OWNR we have to create all the tables,
    types,procedures, packages and obj.....This schema will have
    both DDL and DML privileges.
    In the schema, COPY we are not supposed to create any tables,
    objects. We have to create public synonyms for all the tables,
    types, procedures... in OWNR and grant ALL privilege to the
    schema COPY.The schema, COPY will have only DML privileges.
    The problem is we have some nested tables in our application.
    When I try to insert into the synonym which is created for the
    nested table, it is not allowing me to insert..The whole
    implementation is stucked..Please help.The scripts are given
    below.......
    We have a type name SITA_ADDRESS_TY which is used by the nested
    table SITA_ADDRESSES_NT.Script used for creating the Type,Nested
    table,Table, Public Synonym and granting all privilege to these
    types and tables are
    CREATE OR REPLACE TYPE SITA_ADDRESS_TY AS OBJECT (
    SITA_ADDRESS VARCHAR2(10),
    REMARKS VARCHAR2(100)) ;
    PROMPT SITA_ADDRESSS_NT...
    CREATE OR REPLACE TYPE SITA_ADDRESSES_NT AS TABLE OF
    SITA_ADDRESS_TY ;
    Using this nested table we have created the table,
    UMS_SITA_ADDRESS
    CREATE TABLE UMS_SITA_ADDRESS (
    COMPANY_CODE VARCHAR2 (6) NOT NULL,
    AIRLINE_CODE VARCHAR2 (6) NOT NULL,
    DESTINATION VARCHAR2 (6) NOT NULL,
    SITA_ADDRESS SITA_ADDRESSES_NT)
    TABLESPACE EKUMDAT
    PCTFREE 5
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 64K
    PCTINCREASE 0
    MINEXTENTS 1
    MAXEXTENTS 505
    FREELISTS 1 FREELIST GROUPS 1 )
    NOCACHE
    NESTED TABLE SITA_ADDRESS STORE AS UMSNT_SITA_ADDRESS ;
    PROMPT SYNONYM SITA_ADDRESS_TY...
    CREATE PUBLIC SYNONYM SITA_ADDRESS_TY FOR SITA_ADDRESS_TY
    PROMPT SYNONYM SITA_ADDRESSES_NT...
    CREATE PUBLIC SYNONYM SITA_ADDRESSES_NT FOR SITA_ADDRESSES_NT
    PROMPT UMS_SITA_ADDRESS...
    CREATE PUBLIC SYNONYM UMS_SITA_ADDRESS FOR UMS_SITA_ADDRESS
    Granting Privileges
    PROMPT SITA_ADDRESS_TY...
    GRANT EXECUTE ON SITA_ADDRESS_TY TO COPY
    PROMPT SITA_ADDRESSS_NT...
    GRANT EXECUTE ON SITA_ADDRESSES_NT TO COPY
    PROMPT UMS_SITA_ADDRESS...
    GRANT ALL ON UMS_SITA_ADDRESS TO COPY
    When I connect to copy and desc UMS_SITA_ADDRESS, the structure
    is
    SQL> desc ums_sita_address
    Name Null? Type
    COMPANY_CODE NOT NULL VARCHAR2(6)
    AIRLINE_CODE NOT NULL VARCHAR2(6)
    DESTINATION NOT NULL VARCHAR2(6)
    SITA_ADDRESS
    OWNR.SITA_ADDRESSES_NT
    Why is it so??. Even though I have a synonym for
    SITA_ADDRESSES_NT, it is not referencing the synonym but instead
    refer the OWNR.SITA_ADDRESSES_NT
    Because of this when I try to insert into ums_sita_address(in
    schema COPY), it is giving the following error,
    SQL> insert into ums_sita_address values
    ('EK','EK','DXB',SITA_ADDRESSES_NT());
    insert into ums_sita_address values
    ('EK','EK','DXB',SITA_ADDRESSES_NT())
    ERROR at line 1:
    ORA-00932: inconsistent datatypes
    But when the same connect to OWNR and try to insert with the
    same stmt, it is inserting...
    Our middle tier can connect only to COPY schema alone..Is there
    anything to be done in the DBA side to achieve this??.
    Please help from your valuabe experience...Or can you ask your
    collegues if they have got a soln to this probs..We are stucked
    with this...
    Thanks
    Priya

    Hi
    I am not sure but maybe you need to use this command:
    SQL> insert into ums_sita_address values
    ('EK','EK','DXB',SITA_ADDRESSES_TY());
    SITA_ADDRESSES_TY() instead SITA_ADDRESSES_NT
    Regards

  • Problem in creation of Nested Table

    Hi Everyone,
    I have applied thisexample for creating nested tables but at the end I got the message of invalid datatype
    current_address full_mailing_address_type,
    ERROR at line 4:
    ORA-00902: invalid datatype
    http://www.praetoriate.com/oracle_tips_nested_tables.htm
    Please help me out.....
    Message was edited by:
    Dharmendra

    What is the output for
    select * from user_types
    ?

  • Problem in creating a nested table

    Hi i am working on Oracle 10g and cleint is sqlplus.
    Now while creating a nested table following error occured.
    This is the script for your reference.:
    CREATE OR REPLACE TYPE sec_pwd_hist_table
    AS
    TABLE OF sec_pwd_history_type
    index by binary_integer
    Warning: Type created with compilation errors.
    SQL> show error
    Errors for TYPE SEC_PWD_HIST_TABLE:
    LINE/COL ERROR
    0/0      PL/SQL: Compilation unit analysis terminated
    3/1      PLS-00355: use of pl/sql table not allowed in this context
    Please help on this issue
    Regards,
    Vikas Kumar

    > but i want to know just one thing why its working when i am removing "INDEX BY binaty_integer"
    Vikas, I trust I answered that question when I said? :
    "Do not confuse the two. Do not attempt to use PL/SQL array struct definition syntax in the SQL engine for defining an ADT collection. Which is why I referred you to the manual to see how an ADT is defined in SQL."
    In other words, you are trying to apply a PL/SQL concept and PL/SQL syntax to a definition of a data type in SQL.
    SQL is not PL/SQL.
    SQL ADTs are not PL/SQL arrays/tables.
    It is not even a syntax issue - it is a basic concept issue. SQL does not support PL/SQL arrays/tables. Period.

  • Select from nested table in a nested table security problem

    please help
    running Oracle 9.2.0.3.0 on RH AS 2.1
    I can select the inner most nested table as the creator, but can't use the same select statement as USER2.
    ORA-00942: table or view does not exist
    -- begin make of objects and tables
    create or replace type mydata_t as object ( x float, y float);
    create or replace type mydata_tab_t as table of mydata_t;
    create or replace type mid_t as object (
         graphname varchar2(12),
         datapoints mydata_tab_t );
    create or replace type mid_tab_t as table of mid_t;
    create or replace type top_t as object (
         someinfo int,
         more_mid     mid_tab_t );
    create table xyz (
         xyzPK int,
         mainstuff     top_t )
         nested table mainstuff.more_mid store as mid_nt_tab
              (nested table datapoints store as mydata_nt_tab)
    -- grants
    grant all on mydata_t to user2;
    grant all on mydata_tab_t to user2;
    grant all on mid_t to user2;
    grant all on mid_tab_t to user2;
    grant all on top_t to user2;
    grant all on xyz to user2;
    -- insert
    insert into xyz values (1, top_t(22,mid_tab_t(mid_t('line1',mydata_tab_t(
    mydata_t(0,0),
    mydata_t(15,15),
    mydata_t(30,30))))));
    commit;
    -- select fails as user2
    select * from table(select Y.datapoints as DP_TAB
         from table(select X.mainstuff.more_mid as MORE_TAB
              from scott.xyz X
              where X.xyzPK=1) Y
         where Y.graphname='line1') Z;
    -- select works as user2, but i need individual lines
    select Y.datapoints as DP_TAB
         from table(select X.mainstuff.more_mid as MORE_TAB
              from scott.xyz X
              where X.xyzPK=1) Y
         where Y.graphname='line1';

    Thank you for your reply.
    I have tried
    select value(t) from table t;
    but it is still not working. I got almost the same answer as before.
    Anyway thank you very much again.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by MARCELO OCHOA ([email protected]):
    Originally posted by meimei wu ([email protected]):
    [b]I created a nested object-relational table using REF type in oracle8i. when I tried to select * from the table, I got lots of number as the ref type values, but actually, the value in ref type should be of type varchar2 and number. The number I got looked like following code:
    JARTICLE_REF_TYPE(000022020876108427C2FE0D00E0340800208FD71F76103B99B12009C0E0340800208FD71F,
    Does anyone know how I can get the actual value that I inserted into the nested table?
    your help is appreciated.<HR></BLOCKQUOTE>
    Try this:
    select value(t) from table t;
    Best regards, Marcelo.
    null

  • Problem in truncate/drop partitions in a table having nested table columns.

    Hi,
    I have a table that has 2 columns of type nested table. Now in the purge process, when I try to truncate or drop a partition from this table, I get error that I can't do this (because table has nested tables). Can anybody help me telling how I will be able to truncate/drop partition from this table? IF I change column types from nested table to varray type, will it help?
    Also, is there any short method of moving existing data from a nested table column to a varray column (having same fields as nested table)?
    Thanks in advance.

    >
    I have a table that has 2 columns of type nested table. Now in the purge process, when I try to truncate or drop a partition from this table, I get error that I can't do this (because table has nested tables). Can anybody help me telling how I will be able to truncate/drop partition from this table?
    >
    Unfortunately you can't do those operations when a table has a nested table column. No truncate, no drop, no exchange partition at the partition level.
    A nested table column is stored as a separate table and acts like a 'child' table with foreign keys to the 'parent' table. It is these 'foreign keys' that prevent the truncation (just like normal foreign keys prevent truncating partions and must be disabled first) but there is no mechanism to 'disable' them.
    Just one excellent example (there are many others) of why you should NOT use object columns at all.
    >
    IF I change column types from nested table to varray type, will it help?
    >
    Yes but I STRONGLY suggest you take this opportunity to change your data model to a standard relational one and put the 'child' (nested table) data into its own table with a foreign key to the parent. You can create a view on the two tables that can make data appear as if you have a nested table type if you want.
    Assuming that you are going to ignore the above advice just create a new VARRAY type and a table with that type as a column. Remember VARRAYs are defined with a maximum size. So the number of nested table records needs to be within the capacity of the VARRAY type for the data to fit.
    >
    Also, is there any short method of moving existing data from a nested table column to a varray column (having same fields as nested table)?
    >
    Sure - just CAST the nested table to the VARRAY type. Here is code for a VARRAY type and a new table that shows how to do it.
    -- new array type
    CREATE OR REPLACE TYPE ARRAY_T AS VARRAY(10) OF VARCHAR2(64)
    -- new table using new array type - NOTE there is no nested table storage clause - arrays stored inline
    CREATE TABLE partitioned_table_array
         ( ID_ INT,
          arra_col  ARRAY_T )
         PARTITION BY RANGE (ID_)
         ( PARTITION p1 VALUES LESS THAN (40)
         , PARTITION p2 VALUES LESS THAN(80)
         , PARTITION p3 VALUES LESS THAN(100)
    -- insert the data from the original table converting the nested table data to the varray type
    INSERT INTO PARTITIONED_TABLE_ARRAY
    SELECT ID_, CAST(NESTED_COL AS ARRAY_T) FROM PARTITIONED_TABLENaturally since there is no more nested table storage you can truncate or drop partitions in the above table
    alter table partitioned_table_array truncate partition p1
    alter table partitioned_table_array drop partition p1

  • Create a view problem on nested tables

    I have a table which has a column of nested table:
    create table Person (
    id NUMBER(10), --primary key
    attr1 varchar2(10),
    attr2 varchar2(10),
    kids KIDS_NT --KIDS_NT is a nested table of object
    --which has two columns: name, age.
    ) nested table store as kids_nt_tab;
    Now I like to create a view which has the id (key), concatenation of attr1 and attr2 with a ".", and count of how many kids this persion has):
    create view Person_V as (
    select id, attr1||'.'||attr2 as attr12,
    count(*) from A a, table(a.kids)
    group by id)
    This won't work since it says attr1.attr2 is not a GROUP BY expression. If I don't specify a group by statement, it will say "not a single group group function).
    One solution that I think it will work but quite ugly is to create a view of id and attr1.attr2, andother for id and kids count, then a final view to join them.
    Does anyone have a better solution? Thanks in advance!
    Alice

    One way could be:
    SQL> create or replace type kids as object (
      2         name varchar2(10),
      3         age  number) ;
      4  /
    Type created.
    SQL>
    SQL> create or replace type kids_nt as table of kids ;
      2  /
    Type created.
    SQL>
    SQL> create table Person (
      2      id NUMBER(10) primary key,
      3      attr1 varchar2(10),
      4      attr2 varchar2(10),
      5      kids KIDS_NT
      6  ) nested table kids store as kids_nt_tab;
    Table created.
    SQL>
    SQL> insert into Person values (1, 'attr1', 'attr2', kids_nt(kids('kid1', 10), kids('kid2', 8))) ;
    1 row created.
    SQL> insert into Person values (2, 'attr1', 'attr2', kids_nt(kids('kid1', 6), kids('kid2', 13))) ;
    1 row created.
    SQL>
    SQL> select id, attr1||' '||attr2, (select count(*) cnt from table(p.kids)) cnt
      2  from Person p
      3  /
            ID ATTR1||''||ATTR2             CNT
             1 attr1 attr2                    2
             2 attr1 attr2                    2
    2 rows selected.
    SQL>

  • Problem in using Nested TABLE

    Hi ,
    I created 2 Nested Table & tried to insert the data in Table through Procedure but it gave an err msg.
    create type name as object
    (fname varchar2(20),
    mname varchar2(20),
    lname varchar2(20));
    create type address as object
    (city varchar2(20),
    state varchar2(20),
    pin varchar2(20));
    create type ename as table of name;
    create type eaddress as table of address;
    create table emp_rec
    (employee_id varchar2(5),
    employee_name ename,
    employee_address eaddress)
    nested table employee_name store as empname,
    nested table employee_address store as empaddress;
    insert into emp_rec
    values('1',
    ename(name('anand','kumar','chouksey')),
    eaddress(address('vashi','mh','400093')));
    //Data Inserted
    //Procedure for Inserting Another Data Works
    create or replace procedure nest_proc
    is
    begin
    insert into
    the
    (select employee_address from emp_rec where employee_id=1 ) e
    values('jbp','mp','482002');
    --where employee_id=1;
    end;
    begin
    nest_proc;
    end;
    PL/SQL procedure successfully completed.
    //But if i'll try to insert the data into 2 nested tables then gets failed.
    create or replace procedure nest_proc
    is
    begin
    insert all into
    the
    (select employee_name,employee_address from emp_rec where employee_id=1 ) e
    values('x','y','z');
    into the(select employee_address from emp_rec where employee_id=1 ) e
    values('a','b','c');
    --where employee_id=1;
    end;
    Kindly help me out.
    Rgrds,
    Anand

    Hi,
    Thanks for replying ,actually i did the mistake. I'm using multitable insert stmt. on 2 different tables that's why it gave an err msg.Instead of using multitable insert stmts i used 2 insert stmt. on Procedure & it gets compiled.
    Regards,
    Anand

  • How to use nested tables with the inner table in a separate row

    Hi,
    I am having a problem when changing our existing Adobe printform delivery note so that serial numbers are written for each item line.
    I've searched the forum and found many posts relating to nested tables, but none that had exactly my situation.
    Currently I print item lines like this (this uses the complete width of the form):
    Pos....Quantity...Material..........Description..................................................Date
    99.........99.........ABCDEFGH....alksdalksjdlkasjdlsajdlkjasldjaslkdjakslj........9999.99.99
    .................................................fskdjflsdfljsdflkjsdlkfjsdlkjfdfsf
    .................................................asdkadsfdkfhsdkfhskjdfhks
    but I want to add serial numbers after that for each item like this:
    Pos....Quantity...Material..........Description...................................................Date
    99.........99.........ABCDEFGH....alksdalksjdlkasjdlsajdlkjasldjaslkdjakslj.........9999.99.99
    .................................................fskdjflsdfljsdflkjsdlkfjsdlkjfdfsf
    .................................................asdkadsfdkfhsdkfhskjdfhks
    .................................................Serial numbers:
    .................................................9999999999..9999999999..9999999999
    .................................................9999999999..9999999999..9999999999
    I have added serial numbers to my the current table in the interface/context/data view so it look like this:
    TTYP - ITEM_FIELDS
    ...DATA structure
    ......POSNR
    ......QTY
    ......MATNR
    ......TTYP - ITEM_TEXTS
    .........DATA structure
    ............DESCRIPTION
    ......DATE
    ......TTYP - SERIAL_NOS
    .........DATA structure
    ............SERIAL_COL1
    ............SERIAL_COL2
    ............SERIAL_COL3
    In my Hierarchy I currently have this hierarchy and binding:
    Table - ITEM_FIELDS
    ...Body Row - DATA
    ......Cell - POSNR
    ......Cell - QTY
    ......Cell - MATNR
    ......Subform - ItemTexts
    .........Table - ITEM_TEXTS
    ............Body Row - DATA
    ...............Cell - DESCRIPTION
    ......Cell - DATE
    Now I am trying to add the SERIAL_NOS table into the ITEM_FIELDS/DATA body row right after the DATE cell - but I am not allowed to drag anything into the table structure.
    Does anybody have an ida how I can achieve this, please?
    Kind regards,
    Claus Christensen

    HI,
          Set the body page as flowed and set the tables also flowed.
    go to bodypage>object->subform-->select flowed option.
    I thihnk this will work..if u are getting all the records properly into the tables 1 and 2.
    Thanks,
    Mahdukar

  • Nested Tables in Visual Composer 7.0

    Gurus,
    When I am trying to drag and drop the webservice in the Iview it gives a warning message "Port 'Salesorder' was omitted because it includes nested tables which are not presently supported by Visual Composer" . My question is how to use this webservice which has nested table in one of the input port. Is there any work around or can you suggest me any other way we can call this webservice "ECC_SalesOrderCTRC1".

    Hi,
    Nested tables are not supported by this version of VC.
    This is an architectural problem and I don't know of any work around for it (other than changing the WS).
    Nested tables are and will be supported in VC CE (7.1).
    Regards,
    Shay

Maybe you are looking for

  • Visio Database Wizard fails - ODBC connection to MS SQL

    When I try to create an ODBC connection in Visio's 2010's Database wizard I get the error: "Cannot set the database context information. Additional error information:ODBC Error: s1009. Database cxweba does not exist." Note that the database name is c

  • Demystifing  a Kernal Panic

    I received a kernel panic earlier today and well... all this stuff is Japanese to me. First question can somebody inform me on what the below log says? Second question, is there a place on the web that will tell me some key phrases of a kernel panic

  • Cl_salv_hierseq_table for 3 level

    Hi I need to implement the 3 level of Hierarchical display using class cl_salv_hierseq_table. Also we are not able change the column text in hierarchical output. Please provide the sample code/ any inputs to display the the hierarchical output. thank

  • Credit Manager

    Dear SAP Experts, PLease tell me how do I configure Industry Credit manager for my system. I want Bussiness Partners in the Customer master as Credit Manager. Who will only have the authorization to release a failed credit check. I have configured Au

  • Unable to  Create customer in TCA SETUP(functional)

    Hi Eperts, when iam creating a customer i am getting this error "provide a positve integer for minimum customer balance amount or percent when balance amount overdue type is amount(in r12) Thanks, kumar