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

Similar Messages

  • 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

  • How to write data to text file using external tables

    can anybody tell how to write data to text file using external tables concept?

    Hi,
    Using external table u can load the data in your local table in database,
    then using your local db table and UTL_FILE pacakge u can wrrite data to text file
    external table
    ~~~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
    UTL_FILE
    ~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
    Message was edited by:
    Nicloei W
    Message was edited by:
    Nicloei W

  • 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

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

  • 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

  • Data pump import error with nested tables

    So the problem is somewhat long :)
    Actually the problems are two - why and how oracle are treating OO concept and why data pump doesn't work?
    So scenario for the 1st one:
    1) there is object type h1 and table of h1
    2) there is unrelated object type row_text and table of row_text
    3) there is object type h2 under h1 with attribute as table of row_text
    4) there is table tab1 with column b with data type as table of h1. Of course column b is stored as nested table.
    So how do you think - how many nested tables Oracle will create? The correct answer is 2. One explicitly defined and one hidden with system
    generated name for the type h2 which is under type h1. So the question is WHY? Why if I create an instance of supertype Oracle tries to adapt
    it for the subtype as well? Even more if I create another subtype h3 under h1 another hidden nested table appears.
    This was the first part.
    The second part is - if I do schema export and try to import it in another schema I got error saying that oracle failed to create storage table for
    nested table column b. So the second question is - if Oracle has created such a mess with hidden nested tables how to import/export to another
    schema?
    Ok and here is test case to demonstrate problems above:
    -- creating type h1 and table of it
    SQL> create or replace type h1 as object (a number)
      2  not final;
      3  /
    Type created.
    SQL> create or replace type tbl_h1 as table of h1;
      2  /
    Type created.
    -- creating type row_text and table of it
    SQL> create or replace type row_text as object (
      2    txt varchar2(100))
      3  not final;
      4  /
    Type created.
    SQL> create or replace type tbl_row_text as table of row_text;
      2  /
    Type created.
    -- creating type h2 as subtype of h1
    SQL> create or replace type h2 under h1 (some_texts tbl_row_text);
      2  /
    Type created.
    SQL> create table tab1 (a number, b tbl_h1)
      2  nested table b
      3  store as tab1_nested;
    Table created.
    -- so we have 2 nested tables now
    SQL> select table_name, parent_table_name, parent_table_column
      2  from user_nested_tables;
    TABLE_NAME                     PARENT_TABLE_NAME
    PARENT_TABLE_COLUMN
    SYSNTfsl/+pzu3+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
    TAB1_NESTED                    TAB1
    B
    -- another subtype of t1
    SQL> create or replace type h3 under h1 (some_texts tbl_row_text);
      2  /
    Type created.
    -- plus another nested table
    SQL> select table_name, parent_table_name, parent_table_column
      2  from user_nested_tables;
    TABLE_NAME                     PARENT_TABLE_NAME
    PARENT_TABLE_COLUMN
    SYSNTfsl/+pzu3+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
    SYSNTfsl/+pz03+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"
    TAB1_NESTED                    TAB1
    B
    SQL> desc "SYSNTfsl/+pzu3+jgQAB/AQB27g=="
    Name                                      Null?    Type
    TXT                                                VARCHAR2(100)OK let it be and now I'm trying to export and import in another schema:
    [oracle@xxx]$ expdp gints/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints.log
    Export: Release 11.2.0.1.0 - Production on Thu Feb 4 22:32:48 2010
    <irrelevant rows skipped>
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    . . exported "GINTS"."TAB1"                                  0 KB       0 rows
    . . exported "GINTS"."SYSNTfsl/+pz03+jgQAB/AQB27g=="         0 KB       0 rows
    . . exported "GINTS"."TAB1_NESTED"                           0 KB       0 rows
    . . exported "GINTS"."SYSNTfsl/+pzu3+jgQAB/AQB27g=="         0 KB       0 rows
    Master table "GINTS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    ******************************************************************************And now import. In order to create types transformation of OIDs is applied and also remap_schema
    Although it fails to create the table.
    [oracle@xxx]$ impdp gints1/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
    Import: Release 11.2.0.1.0 - Production on Thu Feb 4 22:41:48 2010
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Release 11.2.0.1.0 - Production
    Master table "GINTS1"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
    Starting "GINTS1"."SYS_IMPORT_FULL_01":  gints1/********@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
    Processing object type SCHEMA_EXPORT/USER
    ORA-31684: Object type USER:"GINTS1" already exists
    Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
    Processing object type SCHEMA_EXPORT/ROLE_GRANT
    Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    ORA-39083: Object type TABLE:"GINTS1"."TAB1" failed to create with error:
    ORA-02320: failure in creating storage table for nested table column B
    ORA-00904: : invalid identifier
    Failing sql is:
    CREATE TABLE "GINTS1"."TAB1" ("A" NUMBER, "B" "GINTS1"."TBL_H1" ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    ORA-39083: Object type INDEX_STATISTICS failed to create with error:
    ORA-01403: no data found
    ORA-01403: no data found
    Failing sql is:
    DECLARE I_N VARCHAR2(60);   I_O VARCHAR2(60);   c DBMS_METADATA.T_VAR_COLL;   df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN  DELETE FROM "SYS"."IMPDP_STATS";   c(1) :=   DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"',1);  DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n);   INSERT INTO "
    ORA-39083: Object type INDEX_STATISTICS failed to create with error:
    ORA-01403: no data found
    ORA-01403: no data found
    Failing sql is:
    DECLARE I_N VARCHAR2(60);   I_O VARCHAR2(60);   c DBMS_METADATA.T_VAR_COLL;   df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN  DELETE FROM "SYS"."IMPDP_STATS";   c(1) :=   DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"',1);  DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n);   INSERT INTO "
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    Job "GINTS1"."SYS_IMPORT_FULL_01" completed with 4 error(s) at 22:41:52So any idea how to make export/import of such tables?
    TIA
    Gints

    Tom Kyte has said it repeatedly ... I will repeat it here for you.
    The fact that Oracle allows you to build object tables is not an indication that you should.
    Store your data relationally and build object_views on top of them.
    http://www.morganslibrary.org/reference/object_views.html
    If you model properly, and store properly, you don' have any issues.

  • Error while fetching data from OWB Client using External Table.

    Dear All,
    I am using Oracle Warehouse Builder 11g & Oracle 10gR2 as repository database on Windows 2000 Server.
    I facing some issue in fetching data from a Flat File using external table from OWB Client.
    I have perform all the steps without any error but when I try to view the data, I got the following error.
    ======================================
    RA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file expense_categories.csv in SOURCE_LOCATION not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    java.sql.SQLException: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file expense_categories.csv in SOURCE_LOCATION not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
         at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:183)
         at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:774)
         at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:849)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
         at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1377)
         at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:386)
         at oracle.wh.ui.owbcommon.QueryResult.<init>(QueryResult.java:18)
         at oracle.wh.ui.owbcommon.dataviewer.relational.OracleQueryResult.<init>(OracleDVTableModel.java:48)
         at oracle.wh.ui.owbcommon.dataviewer.relational.OracleDVTableModel.doFetch(OracleDVTableModel.java:20)
         at oracle.wh.ui.owbcommon.dataviewer.RDVTableModel.fetch(RDVTableModel.java:46)
         at oracle.wh.ui.owbcommon.dataviewer.BaseDataViewerPanel$1.actionPerformed(BaseDataViewerPanel.java:218)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:282)
         at oracle.wh.ui.owbcommon.dataviewer.BaseDataViewerPanel.executeQuery(BaseDataViewerPanel.java:493)
         at oracle.wh.ui.owbcommon.dataviewer.BaseDataViewerEditor.init(BaseDataViewerEditor.java:116)
         at oracle.wh.ui.owbcommon.dataviewer.BaseDataViewerEditor.<init>(BaseDataViewerEditor.java:58)
         at oracle.wh.ui.owbcommon.dataviewer.relational.DataViewerEditor.<init>(DataViewerEditor.java:16)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at oracle.wh.ui.owbcommon.IdeUtils._tryLaunchEditorByClass(IdeUtils.java:1412)
         at oracle.wh.ui.owbcommon.IdeUtils._doLaunchEditor(IdeUtils.java:1349)
         at oracle.wh.ui.owbcommon.IdeUtils._doLaunchEditor(IdeUtils.java:1367)
         at oracle.wh.ui.owbcommon.IdeUtils.showDataViewer(IdeUtils.java:869)
         at oracle.wh.ui.owbcommon.IdeUtils.showDataViewer(IdeUtils.java:856)
         at oracle.wh.ui.console.commands.DataViewerCmd.performAction(DataViewerCmd.java:19)
         at oracle.wh.ui.console.commands.TreeMenuHandler$1.run(TreeMenuHandler.java:188)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    ===========================
    In the error it is showing that file expense_categories.csv in SOURCE_LOCATION not found but I am 100% sure that file is very much there.
    Is anybody face the same issue?
    Do we need to configure something before loading data from a flat file from OWB Client?
    Any help would higly appreciable.
    Regards,
    Manmohan Sharma

    Hi Detlef / Gowtham,
    Now I am able to fetch data from flat files from OWB Server as well as OWB Client.
    One way I have achieved as suggested by you
    1) Creating location on the OWB Client
    2) Samples the files at client
    3) Created & Configured external table
    4) Copy all flat files on OWB Server
    5) Updated the location which I created at the client.
    Other way
    1) Creating location on the OWB Client
    2) Samples the files at client
    3) Created & Configured external table
    4) Copied flat files on the sever in same drive & directory . like if my all flat files are on C:\data at OWB Client then I copied flat file C:\data on the OWB Server. But this is feasible for Non-Windows.
    Hence my problem solved.
    Thanks a lot.
    Regards,
    Manmohan

  • Inserting data with the help of nested table...!!!

    The following block is giving error
    ORA-06502: PL/SQL: numeric or value error
    the signature and signature_bkp have the same structure
    So, can anybody help me out to solve this issue :
    for copying records from one table to another table
    Thanking You advancely
    DECLARE
    CURSOR c1
    IS
    SELECT *
    FROM signature
    WHERE creation_time > TRUNC ( SYSDATE ) - 100
    AND ROWNUM < 102;
    TYPE sig_typ IS TABLE OF signature%ROWTYPE;
    sig_t sig_typ;
    BEGIN
    OPEN c1;
    FETCH c1
    BULK COLLECT INTO sig_t;
    CLOSE c1;
    FORALL i IN sig_t.FIRST .. sig_t.LAST
    INSERT INTO signature_bkp
    VALUES sig_t ( i );
    COMMIT;
    END;
    --DKar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Or whether a INSERT statement with SELECT clause will do that for youby using this technique, it took 47:08:45 to copy 7252 rows
    and by using a cursor for loop took 49:03:23 to copy 13567 rows
    So there was appox. 40% increase in performance by using pl/sql. I thought it could be even faster using the bulk-bind ing features and nested tables.
    OR i just want to know ....how to correct the block of code that was given in my 1st msg without changing its logic.
    Thanks
    --DKar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How do i able to get data for unit price using RSEG table?

    Dear All,
    How do i able to get data for unit price in RSEG table?

    Hi Thiru,
    Please check the logic in thread http://scn.sap.com/thread/1347964
    Hope this helps.
    Regards,
    Deepak Kori

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

  • Stored Proc to create XML (using nested cursors)?

    From previous posts and from the
    documentation for XSQL I have
    discovered the joys of the
    CURSOR operator to create
    nested tables: i.e:
    SELECT dname,
    CURSOR (SELECT ename, sale....) as employees
    FROM dept
    However, I can not find any other
    documentation on how to program (PL/SQL)
    this functionality.
    I would like to use XSQL as
    it is exactly what I need, but
    I can not because my client does
    not want to use Java and they
    require IIS, but do not want to
    use JRUN, etc... (I tried this
    first).
    Since I only need to do an XML
    dump to a variable for processing
    by other parts of the program, life
    is fairly easy. I have already done
    this using Microsoft Data Shapes in
    VB (client does not want VC++ either...)
    However this was slow.
    In order to speed things up I want to
    create a stored procedure in Oracle to
    dump out the XML hierarchy to a variable given
    an SQLQuery input. If I use
    nested CURSORS this should be very easy.
    I would like to create a recursive PL/SQL
    function to handle this, but I have the
    following questions:
    1) I want the function to have an
    input of an open cursor,
    My plan is to detect the column
    type, when it is a nested cursor
    I would recurse with the open cursor
    to handle the nested cursor.
    2) I can not find a reference on to
    programatically handle "untyped collections
    based on an SQL statement" in anything
    other than the XSQL documentation.
    I am assuming that I can detect the
    column type of nested cursor somehow
    and then recurse on this to handle
    dump the recordset to an XML tagset.
    But I wuold like to find some documentation
    or examples on the calls, type statements,
    etc....

    I think the CURSOR() thing is an invention of the XSQL Servlet; not available elsewhere.
    You can accomplish nesting via user defined types and object views, using the "cast(multiset())" syntax, which is not documented particularly well either. This does require some setup, and so is not particularly dynamic.

  • Why on earth use nested tables?

    Hi
    I'm boning up on PL/SQL (again) in anticipation of getting a new job.
    I have many years of experience in various data-related roles, many of which used Oracle.
    On the issue of collections, I find myself asking, in the light of my experience, and not for the first time, why on earth would anyone want to do this:
    create or replace type TEST_TT as table of varchar2(10);
    create table TEST_TABLE ( X number
                             ,Y test_tt)
                             nested table Y store as Y_TABLE;                      I really, really, can't think why we would want to store data like this. It seems to me to be unnecessarily complex, hiding a one-to-many relationship inside TEST_TABLE, which should instead be modelled and implemented as a separate table.
    Furthermore, there are loads of tutorials on collections that tell us how to do the above (indeed I am reading Feuerstein at this very time) but nobody seems to say WHY we should do this.
    Can anybody help me here?
    Thanks.
    Jason

    >
    I'm boning up on PL/SQL (again) in anticipation of getting a new job.
    I have many years of experience in various data-related roles, many of which used Oracle.
    On the issue of collections, I find myself asking, in the light of my experience, and not for the first time, why on earth would anyone want to do this:
    I really, really, can't think why we would want to store data like this. It seems to me to be unnecessarily complex, hiding a one-to-many relationship inside TEST_TABLE, which should instead be modelled and implemented as a separate table.
    Furthermore, there are loads of tutorials on collections that tell us how to do the above (indeed I am reading Feuerstein at this very time) but nobody seems to say WHY we should do this.
    >
    For As you have surmised, just because you CAN do it doesn't mean you SHOULD do it. If you are only working with your standard relational data, such as the example you provide, it has many drawbacks and few, if any advantages.
    It is easier to understand why that capability exists from the viewpoint of the question: why SHOULDN'T you be able to store data like that?
    In one sense it is just another object-oriented feature. You can create object types and pass them around to procedure/functions or external processes (e.g. JDBC) so why shouldn't you be able to store that set of related data as an encapsulated object?
    Why do you need an object type that has a set of columns? You can just as easily put those columns into a table. But how do you manipulate a subset of the columns or rows of a table? How do you pass that data around as a controlled, coherant set of data? You can't.
    With an object type you can, though most often don't, implement encapsulated business rules that ensure that any instance of that type MUST implement. Need ADDRESS information that is required to include a street address, city, state and zip? Create an object type with the right constructor methods and you can ensure that those attributes CANNOT be null.
    Once you have functionality to create and manipulate objects why not be able to pass those objects around and stored them in a table? Doesn't mean you should always store them that way but why not be able to? There isn't any reason to limit that functionality simply because you don't think it is the best practice to use it all the time.
    So if you have a small dataset and want all of that data to 'travel' together nest it. There is no child table to create or foreign key to create.
    I put that functionality in the category of CAN DO but DON'T DO except in rare occasions and consider it a fallout of the move to object-oriented things in general. I like the fact that Oracle makes functionilty like that available when they have it.
    Like dynamic sql, materializeds views, bitmap indexes and much other functionality it is often more important to know when NOT to use it than it is to know when to use it.
    Relative to 'best practices' of why NOT to do that for your basic relational data see this part of the article that Justin referred you to:
    >
    Followup March 3, 2003 - 6am Central time zone:
    1) they are parent child tables in disguise but ones that add:
    a 16 byte raw with a unique constraint on the parent table. Most likely you ALREADY HAVE a primary
    key on the parent table and most likely it is smaller.
    a 16 byte raw that you need to index on the child (not auto-indexed, you need to know to do it).
    This is the foreign key and is hidden from you.
    The inability to put many types of constraints on the nested table..
    They are simple parent/child tables - except you lose the ability to access the child table
    directly.
    2) you are NOT storing anything in a "single row". Physically they are a parent child table pair,
    nothing more, nothing less
    If you have my book "Expert one on one Oracle" - I write about them in there, describe their
    implementation and talk about when I would use them.

Maybe you are looking for