DB Link and nested tables

Is there any way of passing a PL/SQL nested table (IS TABLE OF xxx) when calling a procedure or package across a DB Link in 9i? It does not appear to be possible due to the limitation on use of user types.
Thanks

I would be inclined to discourage you from using nested tables in almost any context. What is the business problem you are trying to solve?
Not coding problem ... business problem.
Perhaps we can suggest a better way to approach the problem.

Similar Messages

  • Query hangs using db link and nested table collection

    Hi,
    I have a stored procedure which takes, as input, a string of values that can vary in length. The input is used as an IN operator within the queries that exist within the proc:
    Code:
    PROCEDURE get_contacts (i_customerids IN VARCHAR2)
    an example of the input would be: '987451',412897' or '7541256','75412','95412589'
    In order to process the dynamic "In-List", I created a custom collection type to convert the string to a table:
    Code:
    CREATE OR REPLACE
    TYPE stringtotable AS TABLE OF VARCHAR2(3900)
    (I've also tried the solutions on http://tkyte.blogspot.com/2006/06/varying-in-lists.html and http://fdegrelle.over-blog.com/article-1694534-6.html for handling dynamic in-lists and they also hang)
    The proc contains 2 queries, the first returns records from a table within the current database:
    Code:
    SELECT *
    FROM contacts
    WHERE customer_id IN (
    SELECT *
    FROM TABLE (stringtotable (i_customerids
    The second query returns records from a database that is defined via a db link:
    Code:
    SELECT b.customer_id, a.row_id, a.fst_name, a.last_name
    FROM userlist.customers@uldblink a, userlist.firms@ulbdlink b
    WHERE a.parent_id = b.row_id
    AND b.customer_id IN (
    SELECT *
    FROM TABLE (stringtotable (i_customerids
    The first query is executing without issue. The second query, however, is hanging indefinitely. Additionally, If I hard code the string in the IN operator, the second query executes without issue.
    I am not the DBA for the database, so I don't currently have access to the trace logs. I've requested access to the trace logs to see if I can figure out what is hanging.
    In the meantime, I was hoping someone would be able to tell me if
    a: there is a better way to handle "dynamic in- lists".
    or
    b: if there is something obvious that I'm not considering.
    Thanks for your help,
    Fielding
    Message was edited by:
    fwilson

    Hi Todd,
    Thanks for the suggestion. I was not aware of the cardinality hint.
    I tried adding it to my query but unfortunately the query still appeared to hang. It did get me thinking though... that maybe the stringtotable collection type is creating the table in memory, and therefore its records aren't accessible to the dblink
    so I inserted the values that were being returned via the stringtotable collection type into a physical table named TestTable. I then modified my query to select the values from TestTable.
    Code:
    ...in (select /*+ cardinality(t 3) */ t.*
    from testtable t)
    This worked.
    So that poses the questions-
    a: is my assumption about the in-memory table correct
    and
    b: if so is there a way around it?
    Thanks for your help

  • SQL Loader Constraints with Column Objects and Nested Tables

    I am working on loading a Table that (god forbid) contains columns, column objects, and nested tables (which contains several depth of column objects). My question is does SQL Loader have a hidding undocumented feature where it states how the column objects must be grouped in refereneced to the nested tables within the loader file? I can load the various column objects, and nested tables fine right now, however, I am loading them all in strange and insane order. Can anyone answer this question? Thanks.
    Peter

    I just noticed that my email is wrong. If you can help, plese send email to [email protected]
    thanks.

  • OCI doc says Cursor and Nested table have the same bind type SQLT_RSET but they don't

    5 Binding and Defining in OCI
    PL/SQL REF CURSORs and Nested Tables in OCI
    says SQLT_RSET is passed for the dty parameter.
    If I use SQLT_RSET for the return value of a function that returns a table and pass a statement handle's address for the OCI parameter data pointer, I expected that the statement handle will be instantiated as a result of executing the function on which I can further perform fetch, similar to a cursor. But it throws exception PLS-00382: expression is of wrong type ORA-06550: line 2, column 3. Is the above documentation wrong?
    From the OCI header file I see that for varray and nested table it mentions to use SQLT_NCO. I could find no example in the OCI documentation on how to pass or receive as return value a nested value when using SQLT_NCO.
    Please help before I shoot myself.

    So the Nested table I quoted in the doc is not actually used to mean a table type below?
    create type t_resultsetdata as object (
    i int, d decimal, c varchar(10)
    create type t_nested_resultsetdata as table of t_resultsetdata;
    create function Blah return t_nested_resultsetdata  is . . .
    For this you are saying to use SQL_NTY and not SQL_NCO. Can you tell where this usage is documented, because ocidfn.h says
    #define SQLT_NTY  108                              
    /* named object type */
    #define SQLT_NCO  122 
    /* named collection type (varray or nested table) */
    Another question - Because of the original document I said I followed, I thought I could treat cursor and nested table similarly in the calling application, i.e. I could repeatedly do a fetch on the OCIStmt* which will be bound for nested table. Now from what you say I understand I can't really bind a OCIStmt* for nested table but have an object type. That means it will get all the data of that collection in one go, right? LIke I said, lack of examples is making this tough. I don't want to look into OCI source code, as that will be too much.

  • Sql*loader and nested tables

    I'm having trouble loading a nested table via sqlldr in Oracle 10g and was hoping someone could point me in the right direction. I keep getting the following error:
    SQL*Loader-403: Referenced column not present in table mynamespace.mytable
    Here's an overview of my type and table definitions:
    create type mynamespace.myinfo as object
    i_name varchar2(64),
    i_desc varchar2(255)
    create TYPE mynamespace.myinfotbl as TABLE of mynamespace.myinfo;
    create table mynamespace.mytable
    Info mynamespace.myinfotbl,
    note varchar2(255)
    NESTED TABLE Info STORE AS mytable_nested_tab;
    My control file looks like this:
    load data
    infile 'mydatafile.csv'
    insert into table mynamespace.mytable
    fields terminated by ',' optionally enclosed by '"'
    TRAILING NULLCOLS
    Info nested table count(6)
    Info column object
    i_name char(64),
    i_desc char(255)
    note
    Example mydatafile.csv would be something like:
    lvl1,des1,lvl2,des2,lvl3,des3,lvl4,des4,lvl5,des5,lvl6,des6,a test data set
    I can't figure out why sqlldr keeps rejecting this control file. I'm using 'direct=false' in my .par file.
    Any hints?

    I just noticed that my email is wrong. If you can help, plese send email to [email protected]
    thanks.

  • Apex, Tabular forms and Nested Tables := Headache

    Hi All,
    I'm constructing an Apex aplication for Performance Reviewing staff and I have need of nested tables within each line item for ongoing comments during the year, the headings of which are drawn from another table, based on a template for which ones are to be used at any given time.
    I'd like to be able to use a tabular form to draw out the history of comments at any given time and modify them however I'm at a complete loss as to how to get this working with a tabular form in Apex. If anyone could point me at some good documentation on the subject or even suggest a better method to get this done I'd be very grateful.
    Thanks!

    Hi,
    Take a look at this article:
    http://www.oracle-base.com/articles/misc/ObjectViewsAndNestedTables.php
    First, create a view as described on your nested and other table(s), with 'Instead Of' triggers handling the DML. Next create the tabular form based on the view. You'll find many posts in the forum regarding building a tablular form based on a view.
    Paul Brookes.

  • "group", "link" and "nest" -- difference?

    You can group, link and test video clips on the timeline. The "nest" one is the only one that seems to actually do anything similar to what I expect. Both group and link don't seem to do a gosh darn thing!

    Group clips
    Link and unlink video and audio clips
    Nesting sequences
    Premiere Pro CS5-CS6 Reference
    (.pdf 12 MB download)
    http://helpx.adobe.com/pdf/premiere_pro_reference.pdf

  • How to insert array of records in Storage table and  Nested table same time??

    Hi,
    I am using ProC++ ( Oracle 8i) . I want to insert a host array
    in a table. That table has a nested table in it. So for every
    record in my host array, there are muliple records to be
    inserted in Nested table. How is this possible using pro*C??
    Pls help.
    Thanks
    Nivedita

    Have a look at the Oracle 9i PL/SQL manual, which has an example.

  • Hierarchical queries and nested tables

    Hallo,
    Assume you have the following data structure:
    SQL> desc mgr
    Name Null? Typ
    MGRNO NUMBER
    LASTNAME VARCHAR2(20)
    EMPS EMPTYPE_TAB
    SQL> desc emptype_tab
    emptype_tab TABLE OF EMP_TYPE
    Name Null? Typ
    EMPNO NUMBER
    LASTNAME VARCHAR2(20)
    I would like to select rows in a hierarchical order to get an output like this:
    LAST_NAME EMPNO MGRNO LEVEL
    King 100 1
    Cambrault 148 100 2
    Bates 172 148 3
    ..but i have absolutely no clue how to use the hierarchical query clause with a nested table.
    can anybody help me?

    scott@ORA92> CREATE OR REPLACE TYPE emp_type AS OBJECT
      2    (empno      NUMBER,
      3       lastname VARCHAR2(20))
      4  /
    Type created.
    scott@ORA92> CREATE OR REPLACE TYPE emptype_tab AS TABLE OF emp_type
      2  /
    Type created.
    scott@ORA92> CREATE TABLE mgr
      2    (MGRNO      NUMBER,
      3       LASTNAME VARCHAR2(20),
      4       EMPS      EMPTYPE_TAB)
      5    NESTED TABLE emps STORE AS emps_nt
      6  /
    Table created.
    scott@ORA92> INSERT INTO mgr VALUES (NULL, NULL, emptype_tab (emp_type (100, 'King')))
      2  /
    1 row created.
    scott@ORA92> INSERT INTO mgr VALUES (100, 'King', emptype_tab (emp_type (148, 'Cambrault')))
      2  /
    1 row created.
    scott@ORA92> INSERT INTO mgr VALUES (148, 'Cambrault', emptype_tab (emp_type (172, 'Bates')))
      2  /
    1 row created.
    scott@ORA92> SELECT * FROM mgr
      2  /
         MGRNO LASTNAME
    EMPS(EMPNO, LASTNAME)
    EMPTYPE_TAB(EMP_TYPE(100, 'King'))
           100 King
    EMPTYPE_TAB(EMP_TYPE(148, 'Cambrault'))
           148 Cambrault
    EMPTYPE_TAB(EMP_TYPE(172, 'Bates'))
    scott@ORA92> SELECT m.mgrno, m.lastname as mgr, e.empno, e.lastname as emp
      2  FROM   mgr m, TABLE (emps) e
      3  /
         MGRNO MGR                       EMPNO EMP
                                           100 King
           100 King                        148 Cambrault
           148 Cambrault                   172 Bates
    scott@ORA92> SELECT lastname, empno, mgrno, LEVEL
      2  FROM   (SELECT m.mgrno, e.lastname, e.empno
      3            FROM   mgr m, TABLE (emps) e)
      4  START  WITH mgrno IS NULL
      5  CONNECT BY PRIOR empno = mgrno
      6  /
    LASTNAME                  EMPNO      MGRNO      LEVEL
    King                        100                     1
    Cambrault                   148        100          2
    Bates                       172        148          3
    scott@ORA92>

  • Error with view link and ADF table Tree

    Hello
    ( Note: View objects are created based on static data but not from database tables)
    I created two view objects "SuiteViewObject" and "FamilyViewObject" which are based on static data( stored in collection) but not on database entity. A veiw link "SuiteFamilyViewLink" is created from the above two view objects. An ADFTreeTable is created from the above view objects and view link. When run the jspx page containing ADFTreeTable, following error is occured in the browser.
    JBO-30003: The application pool (staticviewobjects.staticappLocal) failed to checkout an application module due to the following exception:
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.InvalidOperException, msg=JBO-26016: Cannot set user query to view "FamilyViewObj2" because it is a destination in a view link
    Any help on the above error message.?
    Thanks in Advance
    Kristi
    Bangalore
    Message was edited by:
    user576892

    Hello
    The above error is coming becuase view link's SQL query expects tables. But in my case I dont have tables, view objects are created from static data source(collection).
    How to create a view link from view objects which are created based on static data source(collection)?

  • 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

  • Partition exchange error on table with nested table

    On Oracle 11.2.0.1, I have a partitioned table with some partitions that need to be 'archived' (in terms of moving partitions to an 'archive' table).
    I have a source table like:
    CREATE TABLE IS_PODACI245
      ID_OBJEKTA_IDENTIFIKACIJA  NUMBER(10),
      ID_OBJEKTA                 NUMBER(20),
      DATUM                      TIMESTAMP(6)       NOT NULL,
      TZ                         NUMBER(3),
      DATA1                      NUMBER(10),
      DATA2                      NUMBER(6),
      DATA3                      NUMBER(10),
      DATA4                      NUMBER,
      DATA5                      T_NTCIP_CLIMATE_TABLE
    NESTED TABLE DATA5 STORE AS IS_PODACI245_STORE_TABLE
    TABLESPACE DATA
    PARTITION BY RANGE (DATUM)
      PARTITION P_201107 VALUES LESS THAN (TIMESTAMP' 2011-08-01 00:00:00')
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA, 
      PARTITION P_MAXVALUE VALUES LESS THAN (MAXVALUE)
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    CREATE INDEX IDX_IS_PODACI245_KOMPLEKS ON IS_PODACI245
    (ID_OBJEKTA_IDENTIFIKACIJA, ID_OBJEKTA, DATUM)
      TABLESPACE DATA
    LOCAL ( 
      PARTITION P_201107
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA, 
      PARTITION P_MAXVALUE
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA
    NOPARALLEL;
    CREATE OR REPLACE TYPE t_ntcip_climate_table as table of t_ntcip_climate_fmt;
    CREATE OR REPLACE TYPE t_ntcip_climate_FMT as object
    (  dev_index number(6)
    ,   dev_description varchar2(512)
    ,   dev_type number(10)
    ,   dev_status number(10)
    ,   dev_mfr_status varchar2(512)
    ,   dev_active number(3)
    ,   dev_test_activation number(10)
    /I would like to make exchange partition using stage table, and everything is going fine on all tables, but only on a few of them (listed source is one of them, and they're only tables with nested tables wihin), where I get an error.. but sometimes ;)
    on a statement like:
    ALTER TABLE IS_PODACI245_ARH EXCHANGE PARTITION P_201106  WITH TABLE IS_PODACI245_STAGE EXCLUDING INDEXES  WITHOUT VALIDATION;I got an error:
    ORA-00001: unique constraint (TXV.SYS_C0032911) violated
    it's an unique index between parent and nested table.
    what could cause that problem?

    Dear,
    I suppose that the unique constraint
    ORA-00001: unique constraint (TXV.SYS_C0032911) violatedis the one you 've created on the nested table IS_PODACI245_STORE_TABLE
    If so, why not disable that constraint and try again.
    I have never exchanged such a kind of partitioned table having a nested table in it. But, I could imagine that the cloned non partitioned table IS_PODACI245_STAGE should at least be the exact image of the partitioned table IS_PODACI245_ARH (of course without the partition part) but with the nested table part and including all indexes
    In addition, if you have a parent/child relationship between your partitioned tables, then there is a chronological order of exchange starting by the child and then finishing by the parent
    see the following link for more information about this order of exchange (and comment 2 for an example also)
    http://jonathanlewis.wordpress.com/2006/12/10/drop-parent-partition/#more-65
    Hope this helps
    Mohamed Houri

  • Problem with generating xml and nested cursor (ora-600)

    I have a problem with generating xml (with dbms_xmlquery or xmlgen) and nested cursors.
    When I execute the following command, I get a ORA-600 error:
    select dbms_xmlquery.getxml('select mst_id
    , mst_source
    , cursor(select per.*
    , cursor(select ftm_fdf_number
    , ftm_value
    from t_feature_master
    where ftm_mstr_id = pers_master_id ) as features
    from t_person per
    where pers_master_id = mst_id ) as persons
    from f_master
    where mst_id = 3059435')
    from dual;
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: ORA-00600: internal error code, arguments: [kokbnp2], [1731], [], [], [], [], [], []
    </ERROR>
    The problem is the second cursor (t_feature_master).
    I want to generate this:
    <master>
    <..>
    <persons>
    <..>
    <features>
    <..>
    </features>
    </persons>
    <persons>
    <..>
    <features>
    <..>
    </features>
    </persons>
    </master>
    If i execute the select-statement in sql-plus, then I get the next result.
    MST_ID MST_SOURCE PERSONS
    3059435 GG CURSOR STATEMENT : 3
    CURSOR STATEMENT : 3
    PERS_MASTER_ID PERS_TITLE PERS_INITI PERS_FIRSTNAME PERS_MIDDL PERS_LASTNAME
    3059435 W. Name
    CURSOR STATEMENT : 15
    FTM_FDF_NUMBER FTM_VALUE
    1 [email protected]
    10 ....
    I use Oracle 8.1.7.4 with Oracle XDK v9.2.0.5.0.
    Is this a bug and do somebody know a workaround?

    Very simple...Drop all type objects and nested tables and create them again. You will get no error. I'll explain the reason later.

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Nested tables of user defined types

    Hello all,
    I have philosophical question I am hoping someone can answer for me, "To TYPE, or not to TYPE; that is the question."
    I have created several layers of nested tables in the form:
    CREATE TYPE xyz AS OBJECT();
    CREATE TYPE table_xyz AS TABLE OF xyz;
    CREATE TYPE abc AS OBJECT(
    nested_table1 table_xyz;
    and so on until I end up creating a main table with all these sub tables nested into it.
    But from what I understand oracle stores all of the information in a column of type NESTED TABLE into a single table, rather than one table per row. This means that if I declare a primary key in the nested table it will be against all values in the outer column, not just limited to the values in an individual row of the outer table. Plus it will not let me create foreign keys with in a nested table.
    So why should I use the above construct instead of simply creating separate tables, and use primary and foreign keys to relate them and joins to query?
    I can see the use for types in small cases (addresses, person, etc..) but I do not see the advantage of nested tables. Could someone shed some light on the subject for me?
    Thanks,
    Thomas

    I'll state an opinion, for what it's worth. First, if you are going in the direction of types and nested tables or other collections, you are buying into Oracle's object-relational approach. This has pros and cons as far as design considerations, complexity, and performance that is too involved to get into here. If you just need master/detail table relationships, stick with traditional design techniques. Nested tables can make DML code complex and many tools can't deal with them so you end up having to unnest(flatten) the collections. I'd especially stay away from them if you require multiple nested tables or nested tables within nested tables.

Maybe you are looking for