Performance of Collection Types

Hiya,
We are having severe performance problems using collections in one part of our system. I was hoping that someone may have some suggestions re init.ora parameters, memory allocation etc etc.
The situation is - we have a form which is based on a view. This view in turn is based on a collection within a package specification on the database. This collection is populated before the user enters the form by a call to code on the database, let us call this create_collection. The create_collection code runs a SQL statement which does a CAST( MULTISET and SELECTs from 3 inline views, each of which itself joins to another collection via TABLE(CAST. It should be noted that one of the inline views is joining to a table of size 9 and a half million rows, which is large for our application. Having said that, I have explain planned the code and the execution plan is correctly using the appropriate indexes when you remove the TABLE( CASTS from the from clause of the SQL.
As a temporary solution we could change the view to be based on a series of temporary tables ( which is populated for each user on a session by session basis ). Having benchmarked this we found that performance changed from 90 seconds to query the view using collections, to 0.4 second to query the view when all collections are removed and temporary tables subsituted instead.
Obviously this is a good solution, however the changes required across our system would be numerous to say the least. We use collections extensively elsewhere within the system and have not encountered this performance issue before, having said that nowhere else do we use CAST( MULTISET and TABLE(CAST within the same SQL statement.
So, my question is - does anyone have any tips for increasing the performance of collections when the underlying SQL is processing large volumes of data.
Cheers
Chris

No. Java handles memory alignment internally, you should not be worrying about that yourself. Whatever you think you can do, Java does it better. A lot better. Write dumb code in stead to help the JVM optimize.
http://java.sun.com/developer/technicalArticles/Interviews/devinsight_1/

Similar Messages

  • How to use a collection type of bind variable for execute dynamic statement

    Hi,
    We have a case where we copy selective data from Schema A To Schema B in one oracle database. The copy is achieved by using
    execute immediate 'insert into '||target_schema||'.tablea select * from '||from_schema||'.table a where a.id in (select test_id from '||from_schema||'.table c);';
    This works fine it takes an average of 10 seconds to copy around 14 tables. We have a requirement to bring this time to 2 seconds. One observation has been the clause
    "select test_id from '||from_schema||'.table c" in the above sql statement repeats for many inserts . Thus we were thinking to bulk fetch this set of tests ids and use a bind vatiable of collection type for the execute immediate clause. Any suggestions on how to achieve it?
    Thanks,
    Chandana

    >
    One observation has been the clause
    "select test_id from '||from_schema||'.table c" in the above sql statement repeats for many inserts
    >
    So what? Constructing a string for a table level insert and parsing it can't possibly be a performance problem. If you were creating a string in a loop to insert rows into a table by getting the data FROM a collection - that's a problem that keeps showing up in the forums.
    I'm with bravid and Nikolay on this one. First find out which side, select/insert, the problem is on.
    As they said you need to provide more information about the process.
    And using collections for your use case is definitely not the thing to do.
    1. How many rows are we talking about?
    2. Are the rows being inserted into an empty table?
    3. Are you running these queries during peak production hours or in a batch windows?
    Tune the SELECT if the problem is on that side.
    Post an execution plan for the SELECT part of a query you think should run faster.
    SET SERVEROUTPUT ON
    SET AUTOTRACE TRACEONLY
    SQL> select * from emp;
    Execution Plan
    Plan hash value: 3956160932
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |    14 |   546 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| EMP  |    14 |   546 |     3   (0)| 00:00:01 |
    SQL>On the INSERT side you might be able to use bulk inserts
    ALTER TABLE myTable NOLOGGING;
    INSERT /*+ append */ INTO myTable . . .
    ALTER TABLE myTable LOGGINGIf the insert tables are always reused you could just leave them as NOLOGGING. Since you can't recover bulk data you need to make sure to get a good backup after the loads if you need to recover the data from the logs rather than just reload it yourself.

  • Configuring Kodo default implementation for field of Collection type

    If I am not mistaken default implementation for field of Collection type in
    Kodo is
    LinkedList based proxy. It would be great if it were possible to configure
    Kodo to use a proxy of my choosing
    I did some tests and it seems to me that ArrayList is much more efficient
    than Linked list (see below)
    Is there any specific reason I am not aware of that makes LinkedList better
    than array list
    In my applications all collections a relatively small (or at least most of
    my collections are definitely small)
    and since I use Collection interface there is no inserts into middle of my
    collections - only appends (which ArrayList handles very well)
    So my question is can I make Kodo to use ArrayListProxy for fields of
    Collection type
    (except of course using ArrayList field instead of Collection which I do not
    want to do)
    below is some statistics on collection performance (populating and iterating
    collections)
    the same test against 3 collections implementations (JDK 1.4.1)
    Not only ArrayList by far the fastest and memory friendly it also garbage
    collected much sooner and better -
    I show here max memory consumption and last to would not be garbage
    collected till all memory is in use (old generation GC)
    and ArrayList seems to be collected by young gen GC because it was collected
    very quickly between test cycles why other only when all memory was used
    So please make ArrayList your default collection implementation :-)
    Small collection size (40)
    time(ms) memory(kb)
    ArrayList 5,218 62,154
    LinkedList 14,125 240,066
    HashSet 27,000 311,825
    the same but using using random inserts - append(index, object) rather than
    append(object):
    ArrayList 8937, 53591
    LinkedList 15047, 240066
    Larger collection size (200)
    ArrayList 4860, 47709
    LinkedList 18468, 290704
    HashSet 34391, 422282
    the same but using using random inserts - append(index, object) rather than
    append(object):
    ArrayList 11844, 47709
    LinkedList 25766, 290704

    You should be able to accomplish this fairly easily by extending
    SimpleProxyManager:
    http://solarmetric.com/Software/Documentation/2.4.3/docs/javadoc/com/solarmetric/kodo/util/SimpleProxyManager.html
    and overriding the appropriate methods (getCollectionCopy and
    getCollectionProxy).
    On Mon, 12 May 2003 12:26:21 -0400, Alex Roytman wrote:
    If I am not mistaken default implementation for field of Collection type in
    Kodo is
    LinkedList based proxy. It would be great if it were possible to configure
    Kodo to use a proxy of my choosing
    I did some tests and it seems to me that ArrayList is much more efficient
    than Linked list (see below)
    Is there any specific reason I am not aware of that makes LinkedList better
    than array list
    In my applications all collections a relatively small (or at least most of
    my collections are definitely small)
    and since I use Collection interface there is no inserts into middle of my
    collections - only appends (which ArrayList handles very well)
    So my question is can I make Kodo to use ArrayListProxy for fields of
    Collection type
    (except of course using ArrayList field instead of Collection which I do not
    want to do)
    below is some statistics on collection performance (populating and iterating
    collections)
    the same test against 3 collections implementations (JDK 1.4.1)
    Not only ArrayList by far the fastest and memory friendly it also garbage
    collected much sooner and better -
    I show here max memory consumption and last to would not be garbage
    collected till all memory is in use (old generation GC)
    and ArrayList seems to be collected by young gen GC because it was collected
    very quickly between test cycles why other only when all memory was used
    So please make ArrayList your default collection implementation :-)
    Small collection size (40)
    time(ms) memory(kb)
    ArrayList 5,218 62,154
    LinkedList 14,125 240,066
    HashSet 27,000 311,825
    the same but using using random inserts - append(index, object) rather than
    append(object):
    ArrayList 8937, 53591
    LinkedList 15047, 240066
    Larger collection size (200)
    ArrayList 4860, 47709
    LinkedList 18468, 290704
    HashSet 34391, 422282
    the same but using using random inserts - append(index, object) rather than
    append(object):
    ArrayList 11844, 47709
    LinkedList 25766, 290704

  • Query result window doesn't show contents of collection types

    Hello,
    I use SQL Developer version 3.1.07.
    When inspecting the result of a query in the query window, for collection types containing object types, the contents of the object types are not shown. So you can see the collection having a number of object types, but the content of each object type is not displayed.
    In version 3.1.05 this worked well, so for object type the content is displayed.
    Could you import this functionality again in 3.1.07?
    Best regards,
    Joop

    Hi Joop,
    Have you tried double clicking on the grid cell? That should open an editor to show the individual member object details. If double clicking does not work in some random area of the grid cell, try (scrolling if necessary first) clicking on the extreme right edge of the cell.
    There is some history behind this change. It started with a performance issue populating the grid for SDO_GEOMETRY objects:
    Re: SQLD 3.1EA -  Fails to render resultset output containing SDO_GEOMETRY
    The performance fix resulted in complaints in this forum against the SQL Developer 3.1 production release and logging another bug:
    SQL Developer 3.0.04 - SDO_GEOM Issues
    As far as I know, there has been no resolution on this issue, so the 3.1.07.42 behavior will probably remain unchanged in the next release. But as one of the posts indicates, you can have multiple SQL Developer versions installed on one machine -- you may want to keep that 3.1.05 early adopter version installed in order to view the object details within collections.
    Regards,
    Gary
    SQL Developer Team

  • How to use oracle collection type with JDBC?

    I try to use oracle collection type in java program. So I made some package and java program, however Java program was not found "package.collectiontype"(JDBC_ERP_IF_TEST.NUM_ARRAY) . please, show me how to use this.
    Java Version : Java 1.4
    JDBC Driver : Oracle Oci Driver
    DB: Oracle 9i
    No 1. Package
    ===========================================
    create or replace package JDBC_ERP_IF_TEST AS
    type NUM_ARRAY is table of number;
    procedure JDBC_ERP_IF_ARRAY_TEST(P_NUM_ARRAY IN NUM_ARRAY, ERR_NO OUT NUMBER, ERR_TEXT OUT VARCHAR2);
    procedure TEST(ABC IN NUMBER);
    END JDBC_ERP_IF_TEST;
    ==================================================
    No 2. Package Body
    ===============================================
    CREATE OR REPLACE package BODY JDBC_ERP_IF_TEST is
    procedure JDBC_ERP_IF_ARRAY_TEST(p_num_array IN NUM_ARRAY,
    ERR_NO OUT NUMBER,
    ERR_TEXT OUT VARCHAR2) is
    begin
    ERR_NO := 0;
    ERR_TEXT := '';
    dbms_output.enable;
    for i in 1 .. p_num_array.count() loop
    dbms_output.put_line(p_num_array(i));
    insert into emp (empno) values (p_num_array(i));
    commit;
    end loop;
    EXCEPTION
    WHEN OTHERS THEN
    ERR_NO := SQLCODE;
    ERR_TEXT := ERR_TEXT ||
    ' IN JDBC INTERFACE TEST FOR ORACLE ERP OPEN API..';
    ROLLBACK;
    RETURN;
    end JDBC_ERP_IF_ARRAY_TEST;
    procedure TEST(ABC IN NUMBER) IS
    begin
    insert into emp(empno) values (ABC);
    commit;
    end TEST;
    end JDBC_ERP_IF_TEST;
    ===============================================
    NO 3. Java Program
    ===============================================
    ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("JDBC_ERP_IF_TEST.NUM_ARRAY", getConnection());
    ARRAY array = new ARRAY(descriptor, getConnection(), arrs);
    cstmt = getConnection().prepareCall(LQueryFactory.getInstance().get("Meta/Basic/testJdbcErpArrayIf").getSql());
    cstmt.setArray(1, array);
    cstmt.registerOutParameter(2, Types.INTEGER);
    cstmt.registerOutParameter(3, Types.VARCHAR);
    ====================================================
    couldn't find this phase => JDBC_ERP_IF_TEST.NUM_ARRAY
    what can i do for this package and program? please help me..

    Something like this:
    create or replace type t_record as  object (
    id number,
    no number
    CREATE or replace type t_table AS TABLE OF t_record;
    set serveroutput on
    declare
      v_table t_table := t_table();
      v_t1 t_table := t_table();
    begin
      v_table.extend(1);
      v_table(1).ID := 1;
      v_table(1).No := 10;
      v_table.extend(1);
      v_table(2).ID := 2;
      v_table(2).ID := 20;
      SELEC t_record (ID,NO) BULK COLLECT INTO v_t1
      from TableA
      FROM TABLEA
      WHERE ID IN (select t.ID from table(v_Table) t);
      for i in 1..v_t1.count loop
        dbms_output.put_line(v_t1(i).ID);
        dbms_output.put_line(v_t1(i).No);
      end loop;
    end;
    /Untested!
    P;
    Edited by: bluefrog on Mar 5, 2010 5:08 PM

  • SQL*Modeler - creation of VARRAY or Collection Type of scalar type errors

    In SQl*Modeler 2.0.0 Build 584, I can create either VARRAY or Collections. These work fine for usre defined structured types but I encounter huge problems when I use a simple scalar type of number or varchar2.
    For instance I create a new collection type, give it a name, specify its a collection (or VARRAY, same problem) then click datatype. On the select Data type box I select logical type. A new window opens, I select VARCHAR from the drop down list.
    Enter the size 15, everything appears fine. I click OK, the select data type screen now shows a logical type of VARCHAR(15).
    So far I'm happy. I generate the DDL, everthing is fine, the DDL contains my collection of VARCHAR2(15).
    Now I save the model, close it and re-open the same model. My collection is now of VARCHAR so the next time I generate it will get an error because the syntax is wrong because it has no length. Same problem happens when selecting a NUMBER, looses the precision and scale but at least that command still works, just with a maximum numeric value.
    Ok, so lets try creating distinct types. Why we can't access domains when specifying types from here remains a mystery to me.
    So I create a distinct type Varchar2_15 which is of Logical type VARCHAR and give it a size. Similarly, create another distinct type of NUMERIC_22_0 precision 22 scale 0. This seems to get around the problem of losing the data but the DDL generated shows the datatype to be either VARCHAR (not VARCHAR2) and NUMERIC(22), not number(22). Now I know that VARCHAR currently maps to VARCHAR2 but isn't guaranteed to in the future (even though its been like that since V6) and NUMERIC is just an alias for NUMBER but its going to confuse a lot of java people and its totally inconsitent and just plain wrong.
    Any suggestions or workarounds will be gratefully received.
    Ian Bainbridge

    Hi Ian,
    I see a bug in save/load of collection types and as result no size or precision and scale information. It's fixed in new release.
    However I cannot reproduce the problem with distinct types - I have them generated as varchar2 and number (this is for Oracle).
    You can check:
    - database you use in DDL generation - I got varchar and numeric for MS SQL Server;
    - mapping of logical types VARCHAR and NUMERIC to native types in "Types Administration".
    Philip
    PS - I was able to reproduce it - I looked at wrong place - DDL generation for collection types is broken - it's ok for columns. I logged bug for that.
    Edited by: Philip Stoyanov on Jun 28, 2010 8:55 PM

  • Problems with "import from catalog" & "collection type mismatch"

    I'm attempting to keep 2 catalogs on 2 different computers sunchronized.  I'm exporting photos
    and collections (actually a web gallery) from one computer to another, and
    I'm getting a "collection type mismatch" error, that prevents the photos from being a
    dded to the collection.  I've exported and imported the flash gallery template
    from one system to the other to make sure the templates were identical.  A
    ll the photos, keywords, and attributes seem to be imported properly, but the photos aren't added
    to the collection. Anyone having success exporting/importing collections between computers?
    I'm using LR 2.7 on Win 7 & Vista.
    Thanks,
    Mark

    Thanks Dorin.  I tested it with a "regular" collection, and it works.
    I hope they fix this in v. 3 too!

  • PLS-00642: local collection types not allowed in SQL statements

    Hi,
    I want to retrieve empno in plsql table.
    Now based on the empno in plsql table I want to retrieve thier deptno in another plsql table/varray.
    SQL> declare
      2   type vdeptno  is table of number;
      3    v_deptno vdeptno;
      4    TYPE e_tab is table of  PLS_INTEGER INDEX BY PLS_INTEGER;
      5    empno_tab e_tab;
      6   Begin
      7  Select empno bulk collect into empno_tab FROM emp;
      8  FOR i in empno_tab.FIRST..empno_tab.LAST
      9  LOOP
    10   dbms_output.put_line(empno_tab(i));
    11   Select deptno into v_deptno
    12   FROM emp
    13    where empno=empno_tab(i);
    14   END loop;
    15  END;
    16  /
    Select deptno into v_deptno
    ERROR at line 11:
    ORA-06550: line 11, column 21:
    PLS-00642: local collection types not allowed in SQL statementsAny other way to do the same.
    Twinkle

    When you use this method ...
    type vdeptno is table of number;
    v_deptno vdeptno;
    You need to allocate space to the object prior to inserting into it , (use .EXTENDS for this). Or you need to initialize it while declaring it.
    or try the following
    SQL> declare
    2 type vdeptno is table of number;
    3 v_deptno vdeptno;
    4 TYPE e_tab is table of PLS_INTEGER INDEX BY PLS_INTEGER;
    5 empno_tab e_tab;
    6 Begin
    7 Select empno bulk collect into empno_tab FROM emp;
    8 FOR i in empno_tab.FIRST..empno_tab.LAST
    9 LOOP
    10 dbms_output.put_line(empno_tab(i));
    11 Select deptno bulk collect into v_deptno
    12 FROM emp
    13 where empno=empno_tab(i);
    14 END loop;
    15 END;
    16 /
    Edited by: user9276238 on Jun 14, 2010 3:26 AM

  • Populate collection type from XMLType

    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE     11.1.0.7.0     Production
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    Please bear with me as I'm new to this XML DB thing and also this is my first post.
    I'm trying to populate collection type from XMLType. I was able to populate a table from XMLType but
    couldn't figure out a way to populate the collection type. Here is the description of my problem:
    Object Type:
    CREATE OR REPLACE TYPE DOC_ROWTYPE AS OBJECT
         REFERENCENUMBER VARCHAR2(255),
         REQID NUMBER(12),
         REQDETID NUMBER(12),
         FROMAMOUNT VARCHAR2(31),
         TOAMOUNT VARCHAR2(31),
         TOACCOUNTID NUMBER(12),
         TOACCOUNTNUMBER VARCHAR2(35),
         FROMACCOUNTID NUMBER(12),
         FROMACCOUNTNUMBER VARCHAR2(35),
    Collection Type:
    CREATE OR REPLACE TYPE DOC_TABLETYPE IS TABLE OF DOC_ROWTYPE;
    I have a physical table which is created when I registered a schema.
    A table (Temp_Result) got created with column SYS_NC_ROWINFO$ which is of XMLType.
    As you can see this is only a temporary table which will store the response XML which I want to finally get it to collection type.
    XML to parse:
    <code>
    <TFSResponse>
    <TFS>
    <refNumber>12345</refNumber>
    <reqId>123</reqId>
    <reqDetId>111</reqDetId>
    <fromAmount>20</fromAmount>
    <toAmount>20</toAmount>
    <fromAccount>
    <accountId>22222</id>
    <accountNumber>12345678</number>
    </fromAccount>
    <toAccount>
    <accountId>33333</id>
    <accountNumber>123456789</number>
    </toAccount>
    </TFS>
    .... many TFS Tags
    </TFSResponse>
    </code>
    So each object in the collection is one TFS tag.
    Any advice on how to implement this?

    Does this help
    SQL> CREATE OR REPLACE TYPE ACCOUNT_T as OBJECT (
      2    "accountId"       NUMBER(12),
      3    "accountNumber"   VARCHAR2(35)
      4  )
      5  /
    Type created.
    SQL> show errors
    No errors.
    SQL> --
    SQL> CREATE OR REPLACE TYPE TFS AS OBJECT(
      2     "refNumber"  VARCHAR2(255),
      3     "reqId"      NUMBER(12),
      4     "reqDetId"   NUMBER(12),
      5     "fromAmount" VARCHAR2(31),
      6     "toAmount"   VARCHAR2(31),
      7     "fromAccount" ACCOUNT_T,
      8     "toAccount"   ACCOUNT_T
      9  );
    10  /
    Type created.
    SQL> show errors
    No errors.
    SQL> --
    SQL> CREATE OR REPLACE TYPE TFS_C
      2      as TABLE of TFS
      3  /
    Type created.
    SQL> show errors
    No errors.
    SQL> --
    SQL> CREATE OR REPLACE Type TFS_RESPONSE_T as OBJECT(
      2    "TFSResponse" TFS_C
      3  );
      4  /
    Type created.
    SQL> show errors
    No errors.
    SQL> /
    Type created.
    SQL> CREATE OR REPLACE type CODE_T as OBJECT(
      2    "code" TFS_RESPONSE_T
      3  );
      4  /
    Type created.
    SQL> show errors
    No errors.
    SQL> --
    SQL>
    SQL> with "MY_XML" as
      2  (
      3    select XMLTYPE(
      4  '<code>
      5     <TFSResponse>
      6             <TFS>
      7                     <refNumber>12345</refNumber>
      8                     <reqId>123</reqId>
      9                     <reqDetId>111</reqDetId>
    10                     <fromAmount>20</fromAmount>
    11                     <toAmount>20</toAmount>
    12                     <fromAccount>
    13                             <accountId>22222</accountId>
    14                             <accountNumber>12345678</accountNumber>
    15                     </fromAccount>
    16                     <toAccount>
    17                             <accountId>33333</accountId>
    18                             <accountNumber>123456789</accountNumber>
    19                     </toAccount>
    20             </TFS>
    21             <TFS>
    22                     <refNumber>12346</refNumber>
    23                     <reqId>123</reqId>
    24                     <reqDetId>111</reqDetId>
    25                     <fromAmount>20</fromAmount>
    26                     <toAmount>20</toAmount>
    27                     <fromAccount>
    28                             <accountId>22222</accountId>
    29                             <accountNumber>12345678</accountNumber>
    30                     </fromAccount>
    31                     <toAccount>
    32                             <accountId>33333</accountId>
    33                             <accountNumber>123456789</accountNumber>
    34                     </toAccount>
    35             </TFS>
    36             <TFS>
    37                     <refNumber>12347</refNumber>
    38                     <reqId>123</reqId>
    39                     <reqDetId>111</reqDetId>
    40                     <fromAmount>20</fromAmount>
    41                     <toAmount>20</toAmount>
    42                     <fromAccount>
    43                             <accountId>22222</accountId>
    44                             <accountNumber>12345678</accountNumber>
    45                     </fromAccount>
    46                     <toAccount>
    47                             <accountId>33333</accountId>
    48                             <accountNumber>123456789</accountNumber>
    49                     </toAccount>
    50             </TFS>
    51     </TFSResponse>
    52  </code>') as "XML"
    53    from DUAL
    54  )
    55  select
    56    "TMOBILE"."CODE_T"(
    57      "TMOBILE"."TFS_RESPONSE_T"(
    58        CAST(
    59          MULTISET(
    60            select
    61              "TMOBILE"."TFS"(
    62                "refNumber_000002",
    63                "reqId_000003",
    64                 "reqDetId_000004",
    65                "fromAmount_000005",
    66                "toAmount_000006",
    67                "TMOBILE"."ACCOUNT_T"(
    68                  "accountId_000007",
    69                  "accountNumber_000008"
    70                ),
    71                 "TMOBILE"."ACCOUNT_T"(
    72                  "accountId_000009",
    73                  "accountNumber_000010"
    74                )
    75              )
    76              FROM
    77                XMLTABLE(
    78                  '/TFS'
    79                  passing "TFSResponse_000001"
    80                   COLUMNS
    81                   "refNumber_000002"                  VARCHAR2(255)                       PATH 'refNumber',
    82                   "reqId_000003"                      NUMBER                              PATH 'reqId',
    83                    "reqDetId_000004"                   NUMBER                              PATH 'reqDetId',
    84                   "fromAmount_000005"                 VARCHAR2(31)                        PATH 'fromAmount',
    85                    "toAmount_000006"                   VARCHAR2(31)                        PATH 'toAmount',
    86                     "accountId_000007"                  NUMBER                              PATH 'fromAccount/accountId',
    87                      "accountNumber_000008"              VARCHAR2(35)                        PATH 'fromAccount/accountNumber',
    88                     "accountId_000009"                  NUMBER                              PATH 'toAccount/accountId',
    89                      "accountNumber_000010"              VARCHAR2(35)                        PATH 'toAccount/accountNumber'
    90                )
    91          ) as "TMOBILE"."TFS_C"
    92        )
    93      )
    94    )
    95    FROM MY_XML,
    96      XMLTABLE(
    97        '/'
    98        passing "XML"
    99        COLUMNS
    100              "TFSResponse_000001"                XMLTYPE                             PATH 'code/TFSResponse/TFS'
    101       )
    102
    SQL> /
    CODE_T(TFS_RESPONSE_T(TFS_C(TFS('12345', 123, 111, '20', '20', ACCOUNT_T(22222, '12345678'), ACCOUNT_T(33333, '123456789')), TFS('12346', 123, 111, '20', '20',
    ACCOUNT_T(22222, '12345678'), ACCOUNT_T(33333, '123456789')), TFS('12347', 123, 111, '20', '20',
    ACCOUNT_T(22222, '12345678'), ACCOUNT_T(33333, '123456789')))))
    SQL>

  • (8I) COLLECTION TYPE 변경 방법

    제품 : SQL*PLUS
    작성날짜 : 1999-05-12
    COLLECTION TYPE 변경 방법
    =========================
    collection type은 attribute나 column의 데이타 타입으로
    사용된다. 이전에 정의한 collection type의 property를 변경해야
    하는 경우가 종종 발생하게 되는데 그 작업이 간단하지 않다.
    ALTER TYPE문은 spec이나 body를 재컴파일하거나, member를 추가
    하는 경우에는 사용할 수 있지만 현재 collection의 property를
    바꿀수는 없다. 만약 변경하려한다면 다음 에러가 날 것이다.
    ORA-22319: type attribute information altered in ALTER TYPE
    collection의 property 를 변경하기 위해서는 collection을 drop
    한 후, 다시 만들어야 하는데 참조하는 오브젝트가 존재하는 경우
    dependency 문제로 인해 collection type을 drop 할 수도 없다.
    ORA-02303: cannot drop or replace a type with type
    or table dependents
    즉, Oracle 8i 이전에는 collection의 attribute를 변경하려면
    parent table과 collection type을 모두 drop한 후, 재생성
    해야만 했다.
    그러나 Oracle 8i new feature인 ALTER TABLE DROP COLUM문을
    이용하여 parent table을 drop하지 않고도 collection type의
    attribute를 변경할 수 있게 되었다.
    다음은 parent table을 drop하지 않고 collection (nested table)을
    변경하는 예제이다.
    SQL> /* object type 선언 */
    SQL> create type object_type as object (
    col1 number,
    col2 varchar2(20));
    SQL> /* nested table type 선언*/
    SQL> create type object_ntable as table of object_type;
    SQL> /* parent table 생성 */
    SQL> create table master (
    col1 number primary key,
    col2_list object_ntable)
    nested table col2_list store as master_col2;
    SQL> insert into master values (1,
    object_ntable(object_type(1,'1'),
    object_type(1,'2'),
    object_type(1,'3')));
    SQL> insert into master values (2,
    object_ntable(object_type(2,'1'),
    object_type(2,'2'),
    object_type(2,'3')));
    SQL> commit;
    1. 기존에 저장된 collection data를 임시 table에 저장.
    SQL> create table temp_detail as
    select m.col1 "MASTER_COL1", n.col1, n.col2
    from master m, table(m.col2_list) n;
    SQL> select * from temp_detail;
    MASTER_COL1 COL1 COL2
    1 1 1
    1 1 2
    1 1 3
    2 2 1
    2 2 2
    2 2 3
    2. parent table의 nested table column을 drop 하기
    3. nested table type을 drop하기.
    4. object type을 drop하기.
    SQL> alter table master drop column col2_list;
    SQL> drop type object_ntable;
    SQL> drop type object_type;
    5. attribute을 변경한 object type을 재생성하기
    6. nested table type을 재생성하기.
    SQL> create type object_type as object (
    col1 number,
    col2 varchar2(30));
    SQL> create type object_ntable as table of object_type;
    7. parent table에 nested table column을 추가하기.
    SQL> alter table master add (col2_list object_ntable)
    nested table col2_list store as master_col2;
    8. 임시 테이블에 저장했던 data를 nested table에 저장하기.
    SQL> update master m
    set col2_list = (cast(multiset(
    select col1, col2
    from temp_detail
    where master_col1 = m.col1)
    as object_ntable))
    where col1 in
    (select distinct master_col1 from temp_detail);
    SQL> select * from master;
    COL1
    COL2_LIST(COL1, COL2)
    1
    OBJECT_NTABLE(OBJECT_TYPE(1, '1'), OBJECT_TYPE(1, '2'), OBJECT_TYPE(1, '3'))
    2
    OBJECT_NTABLE(OBJECT_TYPE(2, '1'), OBJECT_TYPE(2, '2'), OBJECT_TYPE(2, '3'))
    * TABLE(), DROP COLUMN 절은 Oracle 8i new features 이다.

    each member of the insert must be a collection, hope this eample helps;
    CREATE OR REPLACE PROCEDURE fast_way IS
    TYPE parent_rec IS RECORD (
    part_num dbms_sql.number_table,
    part_name dbms_sql.varchar2_table);
    p_rec parent_rec;
    CURSOR c IS
    SELECT part_num, part_name
    FROM parent;
    l_done BOOLEAN;
    BEGIN
    OPEN c;
    LOOP
    FETCH c BULK COLLECT INTO p_rec.part_num, p_rec.part_name
    LIMIT 500;
    l_done := c%notfound;
    FORALL i IN 1 .. p_rec.part_num.COUNT
    INSERT INTO child
    (part_num, part_name)
    VALUES
    (p_rec.part_num(i), p_rec.part_name(i));
    EXIT WHEN (l_done);
    END LOOP;
    COMMIT;
    CLOSE c;
    END fast_way;
    /

  • Topic: Incorrect Tag:Multiple Attributes with Same Collection Type

    I have an Object Type that contains multiple attributes with the same collection type. When I use OracleXML getXML to generate xml, the tag for all elements created for any of the matching types is the tag for the 1st of the similar attributes.
    work_t_v is an object view of a relational schema
    SQL> desc work_t_v
    Name Null? Type
    WORK_ID NUMBER(38)
    TITLE_OF_WORK VARCHAR2(512)
    MESH_HEADINGS MESH_HEADINGS_T
    AUTHORS AUTHORS_T
    COMMENT_ON WORK_REFERENCES_T
    COMMENT_IN WORK_REFERENCES_T
    ERRATUM_IN WORK_REFERENCES_T
    REPUBLISHED_FROM WORK_REFERENCES_T
    REPUBLISHED_IN WORK_REFERENCES_T
    SQL> desc work_references_t
    work_references_t TABLE OF WORK_REFERENCE_T
    Name Null? Type
    REFSOURCE VARCHAR2(255)
    NOTE VARCHAR2(255)select
    work.work_id,
    work.title_of_work,
    work.comment_on comment_on,
    work.comment_in comment_in,
    work.erratum_in erratum_in,
    work.republished_from republished_from,
    work.republished_in republished_in
    from work_t_v work
    where work_id = 99350984
    results in tag of <comment_on> for all the elements built from the work_references_t type (i.e., there are no <comment_in>, <erratum_in>, <republished_from> or <republished_in> elements)
    sample result is:
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [CommentOn]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [CommentIn]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [ErratumIn]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [RepublishedFrom]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [RepublishedIn]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    The above xml should be:
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [CommentOn]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    <COMMENT_IN>
    <COMMENT_IN_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [CommentIn]</REFSOURCE>
    </COMMENT_IN_ITEM>
    </ERRATUM_IN>
    <COMMENT_ON>
    <ERRATUM_IN_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [ErratumIn]</REFSOURCE>
    </ERRATUM_IN_ITEM>
    </ERRATUM_IN>
    <REPUBLISHED_FROM>
    <REPUBLISHED_FROM_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [RepublishedFrom]</REFSOURCE>
    </REPUBLISHED_FROM_ITEM>
    </REPUBLISHED_FROM>
    <REPUBLISHED_IN>
    <REPUBLISHED_IN_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601 [RepublishedIn]</REFSOURCE>
    </REPUBLISHED_IN_ITEM>
    </REPUBLISHED_IN>bracketed portion [] is contained within the refsource string to indicate what type of reference it should be displayed as.
    I also found that if I use the -withDTD parameter to include the dtd, the dtd includes the appropriate elements (comment_in, erratum_in, republished_from and republished_in). However, it incorrectly defines refsource and note multiple times (once for each WORK_REFERENCES_T attribute).
    Are these known problems? Will they be fixed? I'm more concerned about the XML problem than the DTD problem.
    Thanks! -- John Butler
    null

    Using the version of XML SQL Utility that comes with the next XSQL Servlet release 0.9.8.6 I did the following:
    create type foo as object (a number);
    create type foolist as table of foo;
    create view fooview
    as select
    cast(multiset(
    select sal from emp where rownum < 2)
    as foolist) list1,
    cast(multiset(
    select sal from emp where rownum < 2)
    as foolist) list2
    from dual;
    When I request a "SELECT * FROM FOOVIEW"
    through getXML I get:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW num="1">
    <LIST1>
    <LIST1_ITEM>
    <A>800</A>
    </LIST1_ITEM>
    </LIST1>
    <LIST2>
    <LIST2_ITEM>
    <A>800</A>
    </LIST2_ITEM>
    </LIST2>
    </ROW>
    </ROWSET>
    So this appears fixed in the next code drop.
    In the interim, I'll email you the new JAR file until (since it won't be on OTN for a few more days).
    null

  • Incorrect Tag:Multiple Attributes with Same Collection Type

    I have an Object Type that contains multiple attributes with the
    same collection type. When I use OracleXML getXML to generate
    xml, the tag for all elements created for any of the matching
    types is the tag for the 1st of the similar attributes.
    work_t_v is an object view of a relational schema
    SQL> desc work_t_v
    Name Null? Type
    WORK_ID NUMBER(38)
    TITLE_OF_WORK VARCHAR2(512)
    MESH_HEADINGS MESH_HEADINGS_T
    AUTHORS AUTHORS_T
    COMMENT_ON WORK_REFERENCES_T
    COMMENT_IN WORK_REFERENCES_T
    ERRATUM_IN WORK_REFERENCES_T
    REPUBLISHED_FROM WORK_REFERENCES_T
    REPUBLISHED_IN WORK_REFERENCES_T
    SQL> desc work_references_t
    work_references_t TABLE OF WORK_REFERENCE_T
    Name Null? Type
    REFSOURCE VARCHAR2(255)
    NOTE VARCHAR2(255)
    select
    work.work_id,
    work.title_of_work,
    work.comment_on comment_on,
    work.comment_in comment_in,
    work.erratum_in erratum_in,
    work.republished_from republished_from,
    work.republished_in republished_in
    from work_t_v work
    where work_id = 99350984
    results in tag of <comment_on> for all the elements built from
    the work_references_t type (i.e., there are no <comment_in>,
    <erratum_in>, <republished_from> or <republished_in> elements)
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601
    [CommentOn]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601
    [CommentIn]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601
    [ErratumIn]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601
    [RepublishedFrom]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    <COMMENT_ON>
    <COMMENT_ON_ITEM>
    <REFSOURCE>J Infect Dis 1998 Aug;178(2):601
    [RepublishedIn]</REFSOURCE>
    </COMMENT_ON_ITEM>
    </COMMENT_ON>
    bracketed portion [] is contained within the refsource string to
    indicate what type of reference it should be displayed as.
    I also found that if I use the -withDTD parameter to include the
    dtd, the dtd includes the appropriate elements (comment_in,
    erratum_in, republished_from and republished_in). However, it
    incorrectly defines refsource and note multiple times (once for
    each WORK_REFERENCES_T attribute).
    Are these known problems? Will they be fixed? I'm more
    concerned about the XML problem than the DTD problem.
    Thanks! -- John Butler
    null

    Using the version of XML SQL Utility that comes with the next XSQL Servlet release 0.9.8.6 I did the following:
    create type foo as object (a number);
    create type foolist as table of foo;
    create view fooview
    as select
    cast(multiset(
    select sal from emp where rownum < 2)
    as foolist) list1,
    cast(multiset(
    select sal from emp where rownum < 2)
    as foolist) list2
    from dual;
    When I request a "SELECT * FROM FOOVIEW"
    through getXML I get:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW num="1">
    <LIST1>
    <LIST1_ITEM>
    <A>800</A>
    </LIST1_ITEM>
    </LIST1>
    <LIST2>
    <LIST2_ITEM>
    <A>800</A>
    </LIST2_ITEM>
    </LIST2>
    </ROW>
    </ROWSET>
    So this appears fixed in the next code drop.
    In the interim, I'll email you the new JAR file until (since it won't be on OTN for a few more days).
    null

  • Collection type supported in Oracle Forms Forms [32 Bit] Version 6.0.8.11.3

    Hi
    I am trying to call this from forms.
    I am getting error no data found whenever this calles IF condition but from backend if run it from a script it works fine.
    So I was thinking whether Forms PL/SQL version supports collection types.
    I am using Forms [32 Bit] Version 6.0.8.11.3 (Production) for Oracle Application 11.5.10 version.
    IF (p_emp_ids.COUNT > 0) THEN
    FOR r IN v_emp_ids.FIRST..v_pkg_ids.LAST LOOP
    Thanks in Advance

    Is it just a a typo that the IF is on P_emp_ids and the loop is on V_em_ids?
    However: the NO_DATA_FOUND exception suggests that you may be falling down a crack in your collection. If you have a missing element between FIRST and LAST you will get a no_data_found. Suppose these elements are there:
    (1), (2). (3), (5), (6)
    You will start at FIRST (1) and finish at LAST (6). But your loop on R will try to find the element at (4). Which isn't there. Oops...
    To prove that's what's happening, you can wrap the inside of the loop with an exception handler
       BEGIN
          do the access to v_emp_ids(r)
       EXCEPTION
          WHEN NO_DATA_FOUND then (log a message with the value if R in it)
       END;If you want to walk a collection with gaps (a "sparse" collection), this is the way:
      DECLARE
         r pls_integer;
      BEGIN
         r := v_empids.FIRST
         LOOP
             EXIT when r IS NULL;
             do the business on v_empids(r);
             r := v_empids(r).NEXT;
         END LOOP;Now, why didn't this work in Forms, but did on the server? Possible reasons:
    - your back end script was set up differently - so you had a dense collection (no gaps)
    - Client side PL/SQL is different from server side (is it still version 1.x?)
    HTH
    Regards Nigel
    Message was edited by:
    nthomas

  • Using TABLE() syntax with collection types

    Hi,
    I have created a function that returns a collection type as TABLE of VARCHAR2.
    Function works just fine like this:
    SELECT * FROM TABLE(some_fcn('VALUE1','VALUE2'));
    Where I am passing in static values.
    However, I need to join this with another table, passing in the values from that table as the parameters:
    SELECT f.some_table_key, t.* FROM some_table f, TABLE(some_fcn(f.col1,f.col2)) t;
    When I do this, I get the error "ORA-00904: "F"."COL1": invalid identifier"
    I am using 11gR1
    Could anyone please offer some guidance with this?
    Thanks!
    Edited by: odinsride on Aug 23, 2010 3:30 PM
    Edited by: odinsride on Aug 23, 2010 3:39 PM

    What are you doing differently?
    SQL> create or replace function some_fcn (col1 varchar2, col2 int)
       return sys.odcivarchar2list
    as
    begin
       return sys.odcivarchar2list (col2);
    end some_fcn;
    Function created.
    SQL> select ename, t.* from emp f, table(some_fcn(f.ename, f.empno)) t
    ENAME      COLUMN_VAL
    SMITH      7369     
    ALLEN      7499     
    WARD       7521     
    JONES      7566     
    MARTIN     7654     
    BLAKE      7698     
    CLARK      7782     
    SCOTT      7788     
    KING       7839     
    TURNER     7844     
    ADAMS      7876     
    JAMES      7900     
    FORD       7902     
    MILLER     7934     
    14 rows selected.can you give a description of your table some_table?

  • Urgent - Does report 6.0 release supports collection types

    Hi,
    We went through the report 6.0 of developer 6.0(beta). There we
    found that it does currently supports all Oracle8 features. The
    major unsupported features are:
    1. Collection types (nested tables and varying arrays).
    2. Stored procedures that return object values.
    But for our forthcoming project we need extensive supports of
    oracle 8 new features like REF, nested table, varying arrays as
    well as stored procedures that return object values.
    So can anybody tell me whether Developer 6.0 realease version
    supports those features.
    Thanks & regards.
    Ashokejyoti Biswas
    null

    Mahesh Gangarapu (guest) wrote:
    : RESPECTED Seniors and Fellow Partners,
    : When I first loaded O8 ver 8.0.4.xxx and then tried to load
    : dev6 . The D6 installation used remove my primary database
    : created . Then I devised a plan I loaded D6 first and then
    : installed O8 ver 8.0.4 . The initial (primary) database was
    : created and i could connect from D6 to my O8 database . But the
    : problem now is that THE D6 supports simple OBJECT types but it
    : does not support NESTED TABLES . The ERROR i get is DATABASE
    : ERROR 1
    : can you help me out with this problem of mine
    : THAnk you
    : Mahesh
    Hi Mahesh
    I've tried this in Forms5.0 and ended up with an error which says
    unsupported network data type.
    The only way, as far as I know , to use a new object feature in
    Oracle 8 through developer R2.x or also R6.0 (i haven't seen
    this) is use a data block created with a stored procedure at the
    back end. U can use REF cursor as one of the parameters in the
    procedure and table type as another parameter. This option will
    definitely work for U. I have done this some time . U should
    create a package with procedures to select , insert , delete and
    update respectively and when U associate a block with this Forms
    will tale care of coding triggers like
    select-procedure
    insert-procedure
    delete-procedure
    update-procedure
    lock-procedure
    Bye Rajesh
    null

Maybe you are looking for

  • Error message "Photoshop cc requires windows 7 or later"

    Hi when using Bridge cc and clicking to open any image the error message appears "Photoshop cc requires windows 7 or later" I am using windows 8.1 P

  • User specific variant (how to )

    Hi gurus, i have made one report. in this report we need different layout.   i have user reuse_alv_grid_display .   our requirement is we want to create one default layout and other user specific layout. so if user doen't have his ownlayout then we w

  • SRM, ROS and SUS scenario question

    Hello Experts, We are in the process of implementing MDM, ROS, EBP and SUS scenario in our present project. I went through the documentation. I have couple of questions. 1. Do we need to have seperate clients for ROS and SUS. What is the best practis

  • Equium L40-17M: What maximum HDD size can I use?

    Just wondering if anyone knows the maximum hard disc size I can install, and what I should be looking for when buying one? Many thanks

  • Why does some of my text in imessage get underlined?

    Why does some of the text in my imessages get automatically underlined, and how do I change this please?