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

Similar Messages

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

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

  • How to use nested tables in adobe form

    Hi All,
    I have to use nested tables in adobe form for table display. I have used Subforms for displaying table data. I have changed accessibility of the subforms. Currently i am able to print print the table correctly if there is single material record in table 1 and single corresponding record in table 2. But the requirement is that i will have multiple lines in table 1 for single material and only one record in table 2.
    EX: form is for Sales order. in line items if the order is for 100 units then we if we have delivered material as 80, 10, 10, then table 1 will have 3 lines for this. Table 2 will always have only 1 corresponding record.
    item--materialdescription-ordered qty--delivered qty--delivery date-price  
    xxx--xxxxxxx-xxxxxxxxx-10080xxxxxxxxxx-xxxx
    10----
    xxxxxxxxxx
    10----
    xxxxxxxxxx
    yyyyyyyyyyyyyyyyyyy------yyyyyyyyyyyyyyyyyyyyy 
    xxxxxx is table 1 and will have multiple lines
    yyyyyy is table 2 and will have only 1 entry for item xxx
    and this group will be repeate as per no of items. table 1 can have any no of lines per item.
    I am currently able to display 1 line for table 1 and 1 line for table 2.
    But how to show multiple lines for table 1 and 1 line for table 2.

    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

  • Storing data in data bse using nested tables

    using nested tables data can be stored in data base or not.
    if yes i need simple example for taht and how to retireve the data from data base.

    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11822/adobjvew.htm#ADOBJ00511
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/composites.htm#LNPLS99981

  • Using nested tables

    Hi experts,
    is there a way of using nested tables, for example:
    Field1
    ---value1-1
    ------example1-1
    ------example1-2
    ------example1-3
    ---value1-2
    ------example2-1
    ------example2-2
    ------example2-3
    ------example2-4
    ------example2-5
    ---value1-3
    ------example3-1
    ------example3-2
    Field2
    ---value2-1
    ------example1-1
    ------example1-2
    Or isn't it possible?
    Thanks
    Michael

    Hi,
    Nested table is not allowed but if it is property structure like address etc which can be included in more than one entities then you can use complex type Complex Types - SAP NetWeaver Gateway Foundation (SAP_GWFND) - SAP Library
    you can refer this Odata Services with Complex Types and Netweaver Gateway : Multiple Output Tables : Odata | SCN
    Regards,
    Chandra

  • What are the advantage of using nested table?

    what are the advantages of using nested table?
    and what are disadvantages of it?

    BTW could you edit the following post and remove the dangerous code
    Re: How to rename a database user?
    Some other poor sap has just fried their database by trying it out
    Re: Can I rename a user?
    Message was edited by:
    3360
    Thank you for making the edit

  • Storing data in data abse using nested  table

    using nested table is it possible 2 store data in data base .give me simple example how tos tore data in data abse usingnested tables.and how to retieve it from data abse.

    See: http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:410619303624

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

  • 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

  • How to use nested table values in IN expression?

    Hi!
    Can someone please give me a hint to the correct syntax for this:
    declare
    TYPE numtable is table of number;
    tt numtable;
    begin
      select myId bulk collect into tt from some_table;
      update some_other_table set name = 'kakadu' where xId in (select * from tt); -- this line is wrong as it is
    end;What I am doing is fixing a stored procedure that was like this before:
    update table_a set name = 'kakadu' where column_X in (select one.A from table_1 one join table_a on x y z WHERE a b c);
    update table_b set name = 'nimfa'  where column_Y in (select one.B from table_1 one join table_a on x y z WHERE a b c);The problem is, the first UPDATE changes the result of the SELECT, so I want to "remember" it.
    A and B are columns in table_1, A is the primary key. So the fixed code would be like:
    -- store the list of selected IDs from table_1
      select A bulk collect into tt from table_1 one join table_a on x y z WHERE a b c ; -- same conditions as in old code
    -- do the updates
      update table_a set name = 'kakadu' where column_X in (select * from tt);
      update table_b set name = 'nimfa' where column_Y in (select one.B from table_1 one where one.A in tt);(it can be a varray instead of nested table, as far as I am concerned)
    Thanks,
    David

    Yes, it needs to be a SQL type
    Re: How to pass an array to a function from a SELECT statement
    Or you can use a built in SQL type (version dependent)
    Re: Collection in where not working

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

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

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

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

  • Using Nested Table in Select Statement

    Hi all ,
    Can i use the PL/SQL nested table or Varray
    in the select statement as a normal table joined with other database tables.
    i.e.
    I have a nested table NT_1 in PL/SQL proc
    i have to use this NT_1 in the select statement as
    select xxx from
    tab_1,
    tab_2,
    NT_1
    where
    < some conditional joins >.
    Please help me in this regard.
    regds
    Dhananjaya.H

    you can not use a varray as part of a SQL Statement in order to build joins.
    Can you explain better what do you want to do ?
    Joel P�rez

  • Using nested tables and varrays in Forms/Reports6i

    Hi! Could anybody give practical examples of applications based on nested tables and varrays in Forms/Reports6i.
    The possible schema of building user interface and so on.
    Thank you.
    [email protected]

    Hi,
    Varrays and nested tables are not supported within Forms6i and Reports6i. This means tare is no way to use it.
    Frank

Maybe you are looking for