Oracle Object Types vs. Table Fields

Hello, all.
I`m totally new to Oracle, and I am facing a very hard problem for me, and I would like to ask your help.
I've been working on a project which uses Oracle Object Types, from a database of a legacy system.
I did not know Oracle Objects until 5 minutes ago, so sorry If I say something stupid:
Per my understanding, a Oracle Object Type can be formed by fields like myField varchar(200)... and fields from an existing table or view.
I have a lot of objects on my system and I need to map each field and its respective table or view that compose each object.
Does anyone have a query for that? I think it should be common, but I could not find anything at google (maybe I don`t which terms use to find...)
I would be very thankful if somebody could help (save) me.
Thanks in advance.
Paulo

First, it would help if you post what you object types look like.
I'm assuming they may look something like this:
SQL> create TYPE emp_type AS OBJECT
  2    (emp_id   NUMBER,
  3     name VARCHAR2(20));
  4  /
Type created.
SQL> create TYPE emp_tab IS TABLE OF emp_type;
  2  /
Type created.
SQL> create or replace package emp_test as
  2  procedure get_emps;
  3  end emp_test ;
  4  /
Package created.
SQL> create or replace package body emp_test as
  2    employees emp_tab := emp_tab();
  3    procedure get_emps as
  4      g_rc sys_refcursor;
  5  BEGIN
  6    employees.EXTEND(2);
  7    employees(1) := emp_type (1, 'John Smith');
  8    employees(2) := emp_type (2, 'William Jones');
  9    OPEN g_rc FOR
10    SELECT * FROM TABLE (CAST (employees AS emp_tab));
11  END get_emps ;
12  end emp_test ;
13  /
Package body created.

Similar Messages

  • Working with oracle object type tables

    Hi,
    I've created a table which only contains Oracle object types (e.g. CREATE TABLE x OF <...>). When I create an Entity for this table using the Entity wizard, I end up with an entity with the attributes of the base object type and two special attributes REF$ (reference to the object type instance) and SYS_NC_OID$ (unique object identifier). The REF$ attribute is on the Java side of type oracle.jbo.domain.Ref and the other attribute is on the Java side a simple String.
    It seems this only allows me to save objects of the base type in this table. First of all in my situation this is also impossible because the base type is not instantiable. What I do want is to save several different subtypes into this table using the BC4J custom domain mechanism. Is there any way to make this possible? I first thought I could maybe do something with the special REF$ attribute, but this doesn't seem te case. So I might need to override most of the EntityImpl methods, like doUML, remove etc. Am I right? And does anyone have any hints on how to do this?
    Regards,
    Peter

    Peter:
    Hi,
    I've created a table which only contains Oracle
    object types (e.g. CREATE TABLE x OF <...>).
    When I create an Entity for this table using the
    Entity wizard, I end up with an entity with the
    attributes of the base object type and two special
    attributes REF$ (reference to the object type
    instance) and SYS_NC_OID$ (unique object identifier).
    The REF$ attribute is on the Java side of type
    oracle.jbo.domain.Ref and the other attribute is on
    the Java side a simple String.
    It seems this only allows me to save objects of the
    base type in this table. First of all in my situation
    this is also impossible because the base type is not
    instantiable. What I do want is to save several
    different subtypes into this table using the BC4J
    custom domain mechanism. Is there any way to make
    this possible? Sorry, but this is not supported out of the box.
    Since you have an object table, you wouldn't use domains to achieve this. Instead, you would have a superclass and subclass entity objects, e.g., PersonEO subclassed into StudentEO and EmployeeEO.
    I first thought I could maybe do
    something with the special REF$ attribute, but this
    doesn't seem te case. So I might need to override
    most of the EntityImpl methods, like doUML, remove
    etc. Am I right? And does anyone have any hints on
    how to do this?
    If you want, you can try this by overridding EntityImpl's:
       protected StringBuffer buildDMLStatement(int operation,
          AttributeDefImpl[] allAttrs,
          AttributeDefImpl[] retCols,
          AttributeDefImpl[] retKeys,
          boolean batchMode)
    and
       protected int bindDMLStatement(int operation,
          PreparedStatement stmt,
          AttributeDefImpl[] allAttrs,
          AttributeDefImpl[] retCols,
          AttributeDefImpl[] retKeys,
          HashMap retrList,
          boolean batchMode) throws SQLException
    Handle the case when operation == DML_INSERT.
    There, build an insert statement with substitutable row, e.g.:
    INSERT INTO persons VALUES (person_t('Bob', 1234));
    INSERT INTO persons VALUES (employee_t('Joe', 32456, 12, 100000));
    where person_t and employee_t are database types and you are invoking the respective constructor.
    Thanks.
    Sung

  • Domains for Oracle object types

    When I create a domain for a certain Oracle object type there is no way to create some kind of inheritance tree (and there is no discriminator support it seems). On the database level I have several object types that extend a certain base object type. I want to do the same at the BC4J level. But unfortunately this doesn't seem possible. Is there a work-around for it? I don't mind to write a little extra code, any hints or help are appreciated.
    Regards,
    Peter
    P.S.
    It seems the object type / domain support in JDeveloper 9.0.3(.1) isn't quite up there with entities and view objects. It's not even possible to change an attribute name at the Java side using the domain dialog (it's only possible by manually editing the XML and Java files). Will JDeveloper 9.0.4 have broader support for object types / domains?

    I've found a way to implement the inheritance myself, at least a start. I've noticed all custom domains for oracle object types have the static method "getCustomerDatumFactory". In this method (in the base domain class) normally an instance of the base type is returned. I've modified this method so that it returns instances of the different subtypes depending on the value of a certain column. To make this work I first have to edit the Java files of the subtypes and let them extend the base type instead of the Struct class. The factory method looks like this:
    public static CustomDatumFactory getCustomDatumFactory()
        if (fac == null)
          class facClass implements CustomDatumFactory
            public CustomDatum create(Datum d, int sql_type_code) throws SQLException
              if (d != null)
                BaseType b = new BaseType(d);
                if ("subtype1".equals(b.getType())) b = new SubType1(d);
                else if ("subtype2".equals(p.getType())) b = new SubType2(d);
                else System.err.println("Unknown subtype: " + b.getType());
                return b;
              return null;
          fac = new facClass();
        return fac;
      }I also tried to save several of the subtypes in the database in the attribute field (which is of the base type) using setAttribute, this seems to work out-of-the-box. It seems for now I only get this to work if the object type is saved in a column of a certain table, I can't get it to work (yet) for object type tables (see the other recent topic of mine).
    Is this the correct way to implement what I want? Or is there a better way?
    Regards,
    Peter

  • Oracle Object Types and XML

    Hi All
    I have oracle object types created.
    <code>
    CREATE OR REPLACE
    TYPE CONFIRM_APP_CONFIRM_ENQUIRY_AT AS OBJECT
    ENQATTRIBTYPECODE VARCHAR2(1000),
    ENQATTRIBVALUECODE VARCHAR2(1000),
    ENQATTRIBSTRINGVALUE VARCHAR2(1000),
    ENQATTRIBNUMVALUE NUMBER,
    ENQATTRIBDATEVALUE DATE
    </code>
    I m using this type for couple of columns in a table
    and then i try to use this procedure which generates XML
    <code>
    BEGIN
    MY_SQL :=
    DBMS_XMLQUERY.NEWCONTEXT
    ( 'Select Nvl(Enquiry_Number,9999) "EnquiryNumber",
    External_System_Reference "ExternalSystemReference",
    External_System_Number "ExternalSystemNumber",
    Service_Code "ServiceCode",
    Subject_Code "SubjectCode",
    Enquiry_Description "EnquiryDescription",
    Enquiry_Location "EnquiryLocation",
    Enquiry_Status_Code "EnquiryStatusCode",
    Assigned_Office_Code "AssignedOfficerCode",
    Logged_Time "LoggedTime",
    EnquiryX "EnquiryX",
    EnquiryY "EnquiryY",
    Site_Code "SiteCode",
    Central_Asset_Id "CentralAssetId",
    Contact_Name "ContactName",
    Contact_Phone "ContactPhone",
    Contact_Fax "ContactFax",
    Contact_Email "ContactEmail",
    Enquiry_Reference "EnquiryReference",
    Enquiry_Class_Code "EnquiryClassCode",
    Notice_From_Org_Code "NoticeFromOrgCode",
    Works_Reference "WorksReference",
    Job_Number "JobNumber",
    Address_Reference "AddressReference",
    enquiry_attribute1 "EnquiryAttribute",
    enquiry_attribute2 "EnquiryAttribute",
    enquiry_attribute3 "EnquiryAttribute",
    enquiry_attribute4 "EnquiryAttribute",
    enquiry_attribute5 "EnquiryAttribute",
    enquiry_attribute6 "EnquiryAttribute",
    enquiry_attribute7 "EnquiryAttribute",
    enquiry_attribute8 "EnquiryAttribute",
    enquiry_attribute9 "EnquiryAttribute",
    enquiry_attribute10 "EnquiryAttribute",
    enquiry_attribute11 "EnquiryAttribute",
    enquiry_attribute12 "EnquiryAttribute",
    enquiry_attribute13 "EnquiryAttribute",
    enquiry_attribute14 "EnquiryAttribute",
    enquiry_attribute15 "EnquiryAttribute",
    enquiry_attribute16 "EnquiryAttribute",
    enquiry_attribute17 "EnquiryAttribute",
    enquiry_attribute18 "EnquiryAttribute",
    enquiry_attribute19 "EnquiryAttribute",
    enquiry_attribute20 "EnquiryAttribute",
    enquiry_customer "EnquiryCustomer",
    enquiry_document "DocumentLink"
    FROM XXHCC_HOLDING_CONFIRM WHERE
    EXTERNAL_SYSTEM_REFERENCE ='
    || EXTERNAL_SYSTEM_REFERENCE
    || '
    AND message_status = ''FAIL'''
    DBMS_XMLQUERY.SETROWSETTAG (MY_SQL, 'Operation');
    DBMS_XMLQUERY.SETROWTAG (MY_SQL, 'NewEnquiry');
    L_XML := DBMS_XMLQUERY.GETXML (MY_SQL);
    DBMS_XMLQUERY.CLOSECONTEXT (MY_SQL);
    </code>
    when i get the xml as output, i get this..
    <code>
    <Operation>
    <NewEnquiry num="1">
    <EnquiryNumber>9999</EnquiryNumber>
    <ExternalSystemReference>4343017</ExternalSystemReference>
    <ExternalSystemNumber>1</ExternalSystemNumber>
    <ServiceCode>HWAY</ServiceCode>
    <SubjectCode>MAIN</SubjectCode>
    <EnquiryDescription>TAI-Highway Maintenance</EnquiryDescription>
    <EnquiryLocation>O/S Cheese Pub</EnquiryLocation>
    <LoggedTime>2008-04-09T08:33:36</LoggedTime>
    <SiteCode>19101890</SiteCode>
    <ContactName>MRS xyz</ContactName>
    <ContactPhone>3434343</ContactPhone>
    <EnquiryReference>CRMHUB</EnquiryReference>
    <NoticeFromOrgCode>ABC</NoticeFromOrgCode>
    <WorksReference>4343017</WorksReference>
    <EnquiryAttribute>
    <ENQATTRIBTYPECODE>CSPL</ENQATTRIBTYPECODE> <ENQATTRIBSTRINGVALUE>n.a</ENQATTRIBSTRINGVALUE>
    </EnquiryAttribute>
    <EnquiryAttribute>
    <ENQATTRIBTYPECODE>CSAI</ENQATTRIBTYPECODE>
    <ENQATTRIBSTRINGVALUE>Cracked Path-Loose Flagstone</ENQATTRIBSTRINGVALUE>
    </EnquiryAttribute>
    <EnquiryAttribute> <ENQATTRIBTYPECODE>CSDL</ENQATTRIBTYPECODE> <ENQATTRIBSTRINGVALUE>No</ENQATTRIBSTRINGVALUE>
    </EnquiryAttribute>
    <EnquiryAttribute>
    <ENQATTRIBTYPECODE>CSIM</ENQATTRIBTYPECODE>
    </EnquiryAttribute>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <EnquiryAttribute/>
    <ENQUIRY_CUSTOMER>
    <CUSTOMER_ALT_PHONE>00</CUSTOMER_ALT_PHONE>
    <CUSTOMER_PRIMARY_ADDRESS>,,0, ABC Street</CUSTOMER_PRIMARY_ADDRESS>
    <CUSTOMER_TOWN_NAME>UK</CUSTOMER_TOWN_NAME>
    <CUSTOMER_COUNTY_NAME>UK</CUSTOMER_COUNTY_NAME>
    <CUSTOMER_POST_CODE>AB1 3QT</CUSTOMER_POST_CODE>
    </ENQUIRY_CUSTOMER>
    </NewEnquiry>
    </Operation>
    </code>
    My question is i m transferring this XML to a third party webservice and it does inserting into a third party application.
    The problem is if you look under EnquiryAttribute tag ENQATTRIBSTRINGVALUE and ENQATTRIBTYPECODE i need this to be in lowercase.
    As the xml is getting automatically generated how do i achieve this. I feel them in the uppercase is causing problems at the other end.
    Any help appreciated
    Srini
    Message was edited by:
    sikhasrinivas

    Use "..." delimiters in the CREATE TYPE (and in all your code that references the type).

  • ERD and oracle object types

    Is there a good way to model oracle object types using ERD's in designer 6i. I can only figure out how to map to tables with columns of predefined datatypes (varchar2, number, date, long). I'd like to use designer to create new datatypes. Is this possible? Thanks.

    Hi Wiiliam
    Sorry for the late acknowledgement (i dozed off!).. Thanks for the response. So the private instance specific to a session ensure that theres no conflict between multiple requests to the same stored proc and hence no conflict of data... Great
    Chaitanya

  • Problem using Oracle Object Types and Arrays.

    I'm currently trying to work with oracle object types in java and I'm running into some issues when trying to add an item to an array.
    The basic idea is that I have a header object and a detail object (both only containing an ID and a description). Inside of my java code I'm trying to add a new detail line to the header that has been retrieved from the database.
    Here's what I'm working with.
    --Oracle Objects:
    CREATE OR REPLACE TYPE dtl_obj AS OBJECT
        detail_id INTEGER,
        header_id INTEGER,
        detail_desc VARCHAR2(300)
    CREATE TYPE dtl_tab AS TABLE OF dtl_obj;
    CREATE OR REPLACE TYPE hdr_obj AS OBJECT
        header_id INTEGER,
        src VARCHAR(30),
        details dtl_tab
    CREATE TYPE hdr_tab AS TABLE OF hdr_obj;
    /--Java test methods
         public static void main(String[] args) throws SQLException,
                   ClassNotFoundException
              // Initialize the objects
              Test t = new Test();
              t.connect(); //Connects to the database
              //The oracle connection will be accessible through t.conn
              // Create the oracle call
              String query = "{? = call get_header(?)}";
              OracleCallableStatement cs = (OracleCallableStatement) t.conn.prepareCall(query);
              cs.registerOutParameter(1, OracleTypes.ARRAY, "HDR_TAB"); //Register the out parameter and associate it with our oracle type
              int[] hdrs = { 240 }; //we just want one for testing.
              ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor(
                        "ARRAY_T", t.conn);
              oracle.sql.ARRAY oHdrs = new ARRAY(descriptor, t.conn, hdrs);
              cs.setARRAY(2, oHdrs); //Set the headers to retrieve
              // Execute the query
              cs.executeQuery();
              try
                   ARRAY invArray = cs.getARRAY(1);
                   // Start the retrieval process
                   Class cls = Class.forName(Header.class.getName());
                   Map<String, Class<?>> map = t.conn.getTypeMap();
                   map.put(Header._SQL_NAME, cls);
                   Object[] invoices = (Object[]) invArray.getArray();
                   ArrayList<Header> invs = new ArrayList(
                             java.util.Arrays.asList(invoices));
                   if (invs != null)
                        for (Header inv : invs)
                             System.out.println(inv.getHeaderId() + " " + inv.getSrc());
                             t.addDetail(inv, "new line");
                             for (Detail dtl : inv.getDetails().getArray()) // Exception thrown here
    //                              java.sql.SQLException: Fail to construct descriptor: Invalid arguments
    //                              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    //                              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    //                              at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
    //                              at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:128)
    //                              at oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:109)
    //                              at com.pcr.tst.Detail.toDatum(Detail.java:40)
    //                              at oracle.jpub.runtime.Util._convertToOracle(Util.java:151)
    //                              at oracle.jpub.runtime.Util.convertToOracle(Util.java:138)
    //                              at oracle.jpub.runtime.MutableArray.getDatumElement(MutableArray.java:1102)
    //                              at oracle.jpub.runtime.MutableArray.getOracleArray(MutableArray.java:550)
    //                              at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:689)
    //                              at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:695)
    //                              at com.pcr.tst.DetailTable.getArray(DetailTable.java:76)
    //                              at com.pcr.tst.Test.main(Test.java:91)
                                  System.out.println(dtl.getDetailDesc());
              catch (Exception ex)
                   System.out.println("Error while retreiving header");
                   ex.printStackTrace();
              public void addDetail(Header hdr, String desc) throws Exception
              if (hdr == null)
                   throw new Exception("header not initialized");
              // Convert the current list to an ArrayList so we can easily add to it.
              ArrayList<Detail> dtlLst = new ArrayList<Detail>();
              dtlLst.addAll(java.util.Arrays.asList(hdr.getDetails().getArray()));
              // Create the new detail
              Detail dtl = new Detail();
              dtl.setDetailDesc(desc);
              // add the new detail
              dtlLst.add(dtl);
              Detail[] ies = new Detail[dtlLst.size()];
              ies = dtlLst.toArray(new Detail[0]);
              DetailTable iet = new DetailTable(ies);
              hdr.setDetails(iet);
         }I know its the addDetail method causing the issue because if I comment out the t.addDetail(inv, "new line"); call it works fine.
    Message was edited by:
    pcristini

    Oracle® Database Object-Relational Developer's Guide
    Also note that object relational database design is often less performant and scalable than relational. It is not very often used in production environments.
    However, the object orientated programming feature that is provided with Oracle object feature set are used and can make development and interfaces a lot easier.
    So in a nutshell. Say no to ref and nested table columns. Say yes to most of the other object features. IMO of course...

  • Debugging Oracle Object types

    Hi
    I'm trying to debug a application (in 9i Release 2) using PL/SQL object types and was wondering if JDev can help.
    I can see the objects, and their code, but the debugger seems unable to step into them, see local variables etc. It also incorrectly identifies code errors -- in short it appears to be using the 9i Release 1 drivers.
    I've just installed version 9.0.3.2 but that hasn't helped. The release notes say helpfully that 9.0.3 can handle the drivers for 9i R2, but it won't use them!
    I'm about to try the 10g preview, but I'm not feeling hopeful. Is this something I can expect to be fixed or do I have to find some other way of debugging my code?
    Thanks,
    Glenn.

    Hi,
    I also have problems debugging oracle objects. I'm running an Oracle Database Version 9.2.0.1.0 and use
    JDeveloper 9.0.3 to remotely debug PL/SQL Code. The debugging works fine when I'm setting breakpoints and
    step through the code.
    But I seem to be unable to list the value of variables of
    object types and variables of nested table types. And of course I cannot set conditional breakpoints on variables that have an Oracle object type. If I try 10g, there is no improvement. The object types are not recognized as Oracle object types or nested table types, instead they are shown as $Oracle.builtin.OPAQUE
    I need this feature to remotely debug procedures, that mostly use Oracle object types as parameters. Is there any possibility that I can get this feature to work? Otherwise JDeveloper is not much of a use for me when I'm debugging PL/SQL code.
    Thanks,
    Astrid
    I provided an example, in which I create the above mentioned types and fill them with data, but where I'm unable to retrieve the values of the variables in JDeveloper:
    ---------------------EXAMPLE--------------------------
    PROMPT Creating TYPE 'ot_hwemployee'
    CREATE OR REPLACE TYPE ot_hwemployee AS OBJECT (
    emp_id NUMBER (10),
    emp_name VARCHAR2 (200)
    PROMPT Creating TYPE 'nt_hwemployee'
    CREATE OR REPLACE TYPE nt_hwemployee AS TABLE OF ot_hwemployee
    PROMPT Creating TYPE 'nt_hwinteger'
    CREATE OR REPLACE TYPE nt_hwinteger AS TABLE OF NUMBER (20)
    PROMPT Creating PROCEDURE 'checkEmployees'
    CREATE OR REPLACE PROCEDURE checkEmployees
    AS
    vnt_employees nt_hwemployee;
    BEGIN
    vnt_employees := nt_hwemployee(ot_hwemployee(1, 'Mustermann Max'),
    ot_hwemployee(2, 'Beispiel Barbara'),
    ot_hwemployee(3, 'Schober-Gant Astrid'));
    deleteemployees(vnt_employees);
    END checkEmployees;
    PROMPT Creating PROCEDURE 'deleteEmployees'
    CREATE OR REPLACE PROCEDURE deleteEmployees (
    pnt_employees IN OUT nt_hwemployee)
    AS
    vnt_employees_deleted nt_hwinteger;
    BEGIN
    vnt_employees_deleted := nt_hwinteger();
    FOR i IN pnt_employees.FIRST .. pnt_employees.LAST LOOP
    IF (pnt_employees(i).emp_id > 2) THEN
    vnt_employees_deleted.EXTEND;
    vnt_employees_deleted(vnt_employees_deleted.COUNT) := pnt_employees(i).emp_id;
    pnt_employees.delete(i);
    END IF;
    END LOOP;
    END deleteEmployees;
    -------------------------END EXAMPLE-------------------

  • How to return Values from Oracle Object Type to Java Class Object

    Hello,
    i have created an Oracle Object Types in the Database. Then i created Java classes with "jpub" of these types. Here is an example of the type.
    CREATE OR REPLACE TYPE person_type AS OBJECT
    ID NUMBER,
    vorname VARCHAR2(30),
    nachname VARCHAR2(30),
    geburtstag DATE,
    CONSTRUCTOR FUNCTION person_type RETURN SELF AS RESULT,
    CONSTRUCTOR FUNCTION person_type(p_id NUMBER) RETURN SELF AS RESULT,
    CONSTRUCTOR FUNCTION person_type(p_vorname VARCHAR2,
    p_nachname VARCHAR2,
    p_geburtstag DATE) RETURN SELF AS RESULT,
    MEMBER FUNCTION object_exists(p_id NUMBER) RETURN BOOLEAN,
    MEMBER PROCEDURE load_object(p_id NUMBER),
    MEMBER PROCEDURE save_object,
    MEMBER PROCEDURE insert_object,
    MEMBER PROCEDURE update_object,
    MEMBER PROCEDURE delete_object
    MEMBER PROCEDURE load_object(p_id NUMBER) IS
    BEGIN
    SELECT p.id, p.vorname, p.nachname, p.geburtstag
    INTO SELF.ID, SELF.vorname, self.nachname, SELF.geburtstag
    FROM person p
    WHERE p.id = p_id;
    END;
    My problem is, that if i use the member function "load_object" from my java app it doesnt return the selected values to the java class and i dont know why. I use the java class like this:
    PersonObjectType p = new PersonObjectType();
    p.load_object(4);
    There is a reocrd in the database with id = 4 and the function will execute successful. But if i try to use "p.getVorname()" i always get "NULL". Can someone tell me how to do that?
    Thanks a lot.
    Edited by: NTbc on 13.07.2010 15:36
    Edited by: NTbc on 13.07.2010 15:36

    CallableStatement =
    "DECLARE
    a person_type;
    BEGIN
    a.load_object(4);
    ? := a;
    END;"
    And register as an out parameter.
    Edited by: michael76 on 14.07.2010 05:01

  • Require help on Array of Nested tables and Oracle Object type

    Hi All,
    I have a scenario where I have some millions of records received from a flat file and the record is stored in Table as below:
    Tablename: FILE_RECORD
    Rows:
    FILE_REG_ID = 1
    RECORD_NBR = 1     
    PROCESSED_IND = U
    RECORD= 00120130326006A
    FILE_REG_ID = 1
    RECORD_NBR = 2     
    PROCESSED_IND = U
    RECORD= 00120130326003
    1) I have to read these records at once and
    a) Split the RECORD column to get various other data Eg: Fld1=001, Fld2=20130326, Fld3 = 003
    b) send as an Array to Java.
    2) Java will format this into XML and sent to other application.
    3) The other application returns a response as Successful or Failure to Java in XML
    4) Java will send RECORD_NBR and the corresponding response as Success or Failure back to PLSQL
    5) PLSQL should match the RECORD_NBR and update the PROCESSED_IND = P.
    I 'm able to achieve this using SQL Table type by creating a TYPE for Each of the fields (Flds) however the problem is Java cannot Access the parameters as the TYPE are of COLUMN Types
    Eg: For RECORD_NBR
    SUBTYPE t_record_nbr IS FILE_RECORD.T010_RECORD_NBR%TYPE;
    Can you please let me know how I can achieve this to support Java, I know one way that is by creating an OBJECT TYPE and a TABLE of the OBJECT TYPE.
    Eg: T_FILE_RECORD_REC IS OBJECT
    FILE_REG_ID number(8), RECORD_NBR number (10), PROCESSED_IND varchar2(1), RECORD varchar(20)
    Create type T_FILE_RECORD_TAB IS TABLE OF T_FILE_RECORD_REC
    However I'm facing a problem to populate an Array of records, I know I'm missing something important. Hence please help.
    It would be helpful to provide some guidelines and suggestions or Pseudo or a Code to achieve this. Rest all I can take up further.
    Thanks in advance,

    I know once way that is creating a OBJECT TYPE and a TABLE of OBJECT TYPE, howeve I feel I'm missing something to achieve this.You're right, you need SQL object types created at the database level. Java doesn't know about locally defined PL/SQL types
    However you can do without all this by creating the XML directly in PL/SQL (steps 1+2) and passing the document to Java as XMLType or CLOB.
    Are you processing the records one at a time?

  • Oracle Object Type Constructor Called Multiple Times

    I have an object type with a custom constructor. In SQL, when I reference the attributes the constructor is called multiple times in Oracle 11.2.0.4.
    Why is the constructor called multiple times?
    How do I stop it?
    My current work around is to reference the attributes and use the /*+ materialize */ hint.
    Problem Setup
        create or replace type Foo as object
          Bar1 NUMBER,
          Bar2 NUMBER,
          Bar3 NUMBER,
          CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
            RETURN SELF AS RESULT
            DETERMINISTIC
        create or replace type body Foo is
          -- Member procedures and functions
          CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
            RETURN SELF AS RESULT
            DETERMINISTIC
          AS
          BEGIN
            SELF.Bar1 := p_Bar1;
            SELF.Bar2 := p_Bar2;
            SELF.Bar3 := p_Bar3;
            dbms_output.put_line('Foo Constructor Called');
            RETURN;
          END;
        end;
    Problem
        -- Constructor is called 6 times!
        -- Once for each column and once for each predicate in the where clause.
        SELECT x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3, f
        FROM (
          SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
          FROM dual d
        ) x
        WHERE x.f.bar1 = x.f.bar1 AND x.f.bar2 = x.f.bar2
    Output
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Workaround
        -- Work Around
        -- Constructor is called 3 times
        -- Once for each column in the inline view.
        -- Note, I removed column f (the object type) because it's not compatible with the materialize hint.
        WITH y AS (
          SELECT /*+ materialize */ x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3
          FROM (
            SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
            FROM dual d
          ) x
        SELECT y.bar1, y.bar2, y.bar3
        FROM y
        WHERE y.bar1 = y.bar1 AND y.bar2 = y.bar2

    Another work-around is described in this thread... Accessing fields of a custom object type... which makes use of a collection type combined with the TABLE operator, like so...
    create or replace type FooTable as table of Foo;
    SELECT x.bar1 AS bar1, x.bar2 AS bar2, x.bar3 AS bar3, value(x) f
        FROM table(FooTable(
          foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3)
        )) x
        WHERE x.bar1 = x.bar1 AND x.bar2 = x.bar2
    BAR1 BAR2 BAR2 F
    1    2    3    (1, 2, 3)
    Foo Constructor Called
    Hope that helps...
    Gerard

  • Partitioned IOT of Object Type - mapping table not allowed for bitmap index

    Hi,
    looks like a feature available for standard Partitioned IOTs is not supported for object based tables, namely the MAPPING TABLE construct to support secondary local bitmap indexes.
    Can you confirm behaviour is as expected/documented?
    If so, is a fix/enhancement to support mapping table for object-based Partitioned IOTs in the pipeline?
    Results for partition-wise load using pipelined table function are very good, look-ups across tens of millions of rows are excellent.
    Environment = Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    OS = Oracle Enterprise Linux Server release 5.2 (Carthage) 2.6.18 92.el5 (32-bit)
    Here's the potted test-case...
    1) First the non object based Partitioned IOT - data is range-partitioned across the alphabet
    CREATE TABLE IOT_Table (
    textData VARCHAR2(10),
    numberData NUMBER(10,0),
    CONSTRAINT IOT_Table_PK PRIMARY KEY(textData))
    ORGANIZATION INDEX MAPPING TABLE PCTFREE 0 TABLESPACE Firewire
    PARTITION BY RANGE (textData)
    (PARTITION Text_Part_A VALUES LESS THAN ('B') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_B VALUES LESS THAN ('C') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_C VALUES LESS THAN ('D') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_D VALUES LESS THAN ('E') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_E VALUES LESS THAN ('F') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_F VALUES LESS THAN ('G') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_G VALUES LESS THAN ('H') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_H VALUES LESS THAN ('I') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_I VALUES LESS THAN ('J') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_J VALUES LESS THAN ('K') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_K VALUES LESS THAN ('L') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_L VALUES LESS THAN ('M') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_M VALUES LESS THAN ('N') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_N VALUES LESS THAN ('O') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_O VALUES LESS THAN ('P') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_P VALUES LESS THAN ('Q') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_Q VALUES LESS THAN ('R') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_R VALUES LESS THAN ('S') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_S VALUES LESS THAN ('T') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_T VALUES LESS THAN ('U') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_U VALUES LESS THAN ('V') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_V VALUES LESS THAN ('W') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_W VALUES LESS THAN ('X') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_X VALUES LESS THAN ('Y') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_Y VALUES LESS THAN ('Z') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_Z VALUES LESS THAN (MAXVALUE) PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0))
    NOLOGGING PARALLEL -- FLASHBACK ARCHIVE IOT_Flashback_Data
    SQL> table IOT_TABLE created.
    2) Create the local secondary bitmap index utilising the underlying mapping table
    CREATE BITMAP INDEX IOT_Table_BMI1 ON IOT_Table (numberData)
    LOCAL STORAGE (INITIAL 1M PCTINCREASE 0 NEXT 512K) NOLOGGING PARALLEL;
    SQL> bitmap index IOT_TABLE_BMI1 created.
    3) Quick test to confirm all ok
    SQL> INSERT INTO IOT_Table VALUES ('ABC123',100);
    SQL> 1 rows inserted.
    SQL> SELECT * FROM IOT_Table;
    TEXTDATA NUMBERDATA
    ABC123     100
    4) Now create a minimal object type to use as the template for object table
    CREATE TYPE IOT_type AS OBJECT
    textData VARCHAR2(10 CHAR),
    numberData NUMBER(10,0)
    ) FINAL
    SQL> TYPE IOT_type compiled
    5) Attempt to create an object-based range partitioned IOT, including MAPPING TABLE clause as per step (1)
    CREATE TABLE IOTObj_Table OF IOT_type (textData PRIMARY KEY)
    OBJECT IDENTIFIER IS PRIMARY KEY ORGANIZATION INDEX
    MAPPING TABLE -- we'd like to use this feature to enable use of Bitmap Indexes...
    PCTFREE 0 TABLESPACE Firewire
    PARTITION BY RANGE (textData)
    (PARTITION Text_Part_A VALUES LESS THAN ('B') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_B VALUES LESS THAN ('C') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_C VALUES LESS THAN ('D') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_D VALUES LESS THAN ('E') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_E VALUES LESS THAN ('F') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_F VALUES LESS THAN ('G') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_G VALUES LESS THAN ('H') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_H VALUES LESS THAN ('I') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_I VALUES LESS THAN ('J') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_J VALUES LESS THAN ('K') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_K VALUES LESS THAN ('L') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_L VALUES LESS THAN ('M') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_M VALUES LESS THAN ('N') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_N VALUES LESS THAN ('O') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_O VALUES LESS THAN ('P') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_P VALUES LESS THAN ('Q') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_Q VALUES LESS THAN ('R') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_R VALUES LESS THAN ('S') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_S VALUES LESS THAN ('T') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_T VALUES LESS THAN ('U') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_U VALUES LESS THAN ('V') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_V VALUES LESS THAN ('W') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_W VALUES LESS THAN ('X') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_X VALUES LESS THAN ('Y') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_Y VALUES LESS THAN ('Z') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
    PARTITION Text_Part_Z VALUES LESS THAN (MAXVALUE) PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0))
    NOLOGGING PARALLEL -- FLASHBACK ARCHIVE IOT_Flashback_Data
    This errors out with the following...
    SQL Error: ORA-25182: feature not currently available for index-organized tables
    25182. 00000 - "feature not currently available for index-organized tables"
    *Cause:    An attempt was made to use one or more of the following feature(s) not
    currently supported for index-organized tables:
    CREATE TABLE with LOB/BFILE/VARRAY columns,
    partitioning/PARALLEL/CREATE TABLE AS SELECT options,
    ALTER TABLE with ADD/MODIFY column options, CREATE INDEX
    *Action:   Do not use the disallowed feature(s) in this release.
    6) Re-running the create table statement in step 5 without the MAPPING TABLE clause works fine. Not surprisingly an attempt to create a secondary local bitmap index on this table fails as there's no mapping table, like so...
    CREATE BITMAP INDEX IOTObj_Table_BMI1 ON IOTObj_Table (numberData)
    LOCAL STORAGE (INITIAL 1M PCTINCREASE 0 NEXT 512K) NOLOGGING PARALLEL;
    CREATE TABLE with LOB/BFILE/VARRAY columns,
    partitioning/PARALLEL/CREATE TABLE AS SELECT options,
    ALTER TABLE with ADD/MODIFY column options, CREATE INDEX
    *Action:   Do not use the disallowed feature(s) in this release.
    CREATE BITMAP INDEX IOTObj_Table_BMI1 ON IOTObj_Table (numberData)
    LOCAL STORAGE (INITIAL 1M PCTINCREASE 0 NEXT 512K) NOLOGGING PARALLEL
    Error at Command Line:99 Column:13
    Error report:
    SQL Error: ORA-00903: invalid table name
    00903. 00000 - "invalid table name"
    7) Creating a secondary local b-tree index is fine, like so...
    SQL> CREATE INDEX IOTObj_Table_I1 ON IOTObj_Table (numberData)
    LOCAL STORAGE (INITIAL 1M PCTINCREASE 0 NEXT 512K) NOLOGGING PARALLEL;
    index IOTOBJ_TABLE_I1 created.
    8) A quick test to ensure object table ok...
    SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('DEF456',500));
    SQL> 1 rows inserted.
    SQL> SELECT * FROM IOTObj_Table;
    TEXTDATA NUMBERDATA
    DEF456     500

    Thanks Dan,
    the intention is to range partition based on the initial character, so A* -> Text_Part_A, B* -> Text_Part_B, and so on.
    Here's an example, using an empty IOTObj_Table as created previously.
    1) Set up & confirm some test data (two 'D's, one 'N', and two 'Z's)
    SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('DEF456',500));
    SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('DDD111',510));
    SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('N3000',515));
    SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('ZZ1212',520));
    SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('Z111X',530));
    SQL> COMMIT;
    SQL> SELECT * FROM IOTObj_Table;
    TEXTDATA NUMBERDATA
    DDD111     510
    DEF456     500
    N3000     515
    Z111X     530
    ZZ1212     520
    2) Just to prove our IOT is enforcing the Primary Key based on the TextData attribute, try to insert a duplicate
    SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('Z111X',530));
    Error starting at line 141 in command:
    INSERT INTO IOTObj_Table VALUES (IOT_Type('Z111X',530))
    Error report:
    SQL Error: ORA-00001: unique constraint (OCDataSystems.SYS_IOT_TOP_84235) violated
    00001. 00000 - "unique constraint (%s.%s) violated"
    *Cause:    An UPDATE or INSERT statement attempted to insert a duplicate key.
    For Trusted Oracle configured in DBMS MAC mode, you may see
    this message if a duplicate entry exists at a different level.
    *Action:   Either remove the unique restriction or do not insert the key.
    3) Now confirm that our data has been slotted into the range-based partition we expect using the PARTITION clause of SELECT...
    - The two 'D's...
    SQL> SELECT * FROM IOTObj_Table PARTITION (Text_Part_D);
    TEXTDATA NUMBERDATA
    DDD111     510
    DEF456     500
    - The single 'N'...
    SQL> SELECT * FROM IOTObj_Table PARTITION (Text_Part_N);
    TEXTDATA NUMBERDATA
    N3000     515
    - The two 'Z's...
    SQL> SELECT * FROM IOTObj_Table PARTITION (Text_Part_Z);
    TEXTDATA NUMBERDATA
    Z111X     530
    ZZ1212     520
    4) And to wrap up confirm an empty partition
    SELECT * FROM IOTObj_Table PARTITION (Text_Part_W);

  • Invoking stored procedure that returns array(oracle object type) as output

    Hi,
    We have stored procedures which returns arrays(oracle type) as an output, can anyone shed some light on how to map those arrays using JPA annotations? I tried using jdbcTypeName but i was getting wrong type or argument error, your help is very much appreciated. Below is the code snippet.
    JPA Class:
    import java.io.Serializable;
    import java.sql.Array;
    import java.util.List;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import org.eclipse.persistence.annotations.Direction;
    import org.eclipse.persistence.annotations.NamedStoredProcedureQuery;
    import org.eclipse.persistence.annotations.StoredProcedureParameter;
    * The persistent class for the MessagePublish database table.
    @Entity
    @NamedStoredProcedureQuery(name="GetTeamMembersDetails",
         procedureName="team_emp_maintenance_pkg.get_user_team_roles",
         resultClass=TeamMembersDetails.class,
         returnsResultSet=true,
         parameters={  
         @StoredProcedureParameter(queryParameter="userId",name="I_USER_ID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="employeeId",name="I_EMPLOYEEID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="TEAMMEMBERSDETAILSOT",name="O_TEAM_ROLES",direction=Direction.OUT,jdbcTypeName="OBJ_TEAM_ROLES"),
         @StoredProcedureParameter(queryParameter="debugMode",name="I_DEBUGMODE",direction=Direction.IN,type=Long.class)
    public class TeamMembersDetails implements Serializable {
         private static final long serialVersionUID = 1L;
    @Id
         private long userId;
         private List<TeamMembersDetailsOT> teamMembersDetailsOT;
         public void setTeamMembersDetailsOT(List<TeamMembersDetailsOT> teamMembersDetailsOT) {
              this.teamMembersDetailsOT = teamMembersDetailsOT;
         public List<TeamMembersDetailsOT> getTeamMembersDetailsOT() {
              return teamMembersDetailsOT;
    Procedure
    PROCEDURE get_user_team_roles (
    i_user_id IN ue_user.user_id%TYPE
    , o_team_roles OUT OBJ_TEAM_ROLES_ARRAY
    , i_debugmode IN NUMBER :=0)
    AS
    OBJ_TEAM_ROLES_ARRAY contains create or replace TYPE OBJ_TEAM_ROLES_ARRAY AS TABLE OF OBJ_TEAM_ROLES;
    TeamMembersDetailsOT contains the same attributes defined in the OBJ_TEAM_ROLES.

    A few things.
    You are not using a JDBC Array type in your procedure, you are using a PLSQL TABLE type. An Array type would be a VARRAY in Oracle. EclipseLink supports both VARRAY and TABLE types, but TABLE types are more complex as Oracle JDBC does not support them, they must be wrapped in a corresponding VARRAY type. I assume your OBJ_TEAM_ROLES is also not an OBJECT TYPE but a PLSQL RECORD type, this has the same issue.
    Your procedure does not return a result set, so "returnsResultSet=true" should be "returnsResultSet=false".
    In general I would recommend you change your stored procedure to just return a select from a table using an OUT CURSOR, that is the easiest way to return data from an Oracle stored procedure.
    If you must use the PLSQL types, then you will need to create wrapper VARRAY and OBJECT TYPEs. In EclipseLink you must use a PLSQLStoredProcedureCall to access these using the code API, there is not annotation support. Or you could create your own wrapper stored procedure that converts the PLSQL types to OBJECT TYPEs, and call the wrapper stored procedure.
    To map to Oracle VARRAY and OBJECT TYPEs the JDBC Array and Struct types are used, these are supported using EclipseLink ObjectRelationalDataTypeDescriptor and mappings. These must be defined through the code API, as there is currently no annotation support.
    I could not find any good examples or doc on this, your best source of example is the EclipseLink test cases in SVN,
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/plsql/
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/customsqlstoredprocedures/
    James : http://www.eclipselink.org

  • Help! JDBC & Oracle Object Type

    Hi all?
    I use JDBC to connect to ORACLE 8i DB...
    it has various kind of New Features of Oracle 8( eg. Oject Type
    like REF, Nested Tables, VArray... ).
    So I'd like to retrieve some Table consisted of general Column
    and REF, Varray, Nested Tables... I succeeded retrieving the
    data from general table with only general columns like number,
    varchar2 consulting Manuals... I use Custom Java Classes
    inheriting CustumDatum Interface...
    However, I cannot find any other solution to get data from
    Tables consisted of Object Features...
    So I'd like to know how to configure Custom Java Classes to map
    to Object Type like Varray, Ref...
    In manual, there's only way to get data from olny the column
    which is Object type, I mean i'd like to know how to get whole
    column's data using Custom Java Classes...
    It will be really thankful if you mail the answer or sample
    codes to me...
    Pls mail to [email protected]
    Thank you all,
    null

    Hi Eddy,
    Use sqlj tool, which generates java classes to
    corresponding object types in oracle 8i. Use these
    (or extend) classes to retrieve the data.
    bye
    MohanE
    Eddy Lim (guest) wrote:
    : Hi all?
    : I use JDBC to connect to ORACLE 8i DB...
    : it has various kind of New Features of Oracle 8( eg. Oject Type
    : like REF, Nested Tables, VArray... ).
    : So I'd like to retrieve some Table consisted of general Column
    : and REF, Varray, Nested Tables... I succeeded retrieving the
    : data from general table with only general columns like number,
    : varchar2 consulting Manuals... I use Custom Java Classes
    : inheriting CustumDatum Interface...
    : However, I cannot find any other solution to get data from
    : Tables consisted of Object Features...
    : So I'd like to know how to configure Custom Java Classes to map
    : to Object Type like Varray, Ref...
    : In manual, there's only way to get data from olny the column
    : which is Object type, I mean i'd like to know how to get whole
    : column's data using Custom Java Classes...
    : It will be really thankful if you mail the answer or sample
    : codes to me...
    : Pls mail to [email protected]
    : Thank you all,
    null

  • Concurrency and Oracle Object Types

    Hi All,
    I have a question regarding Concurrent usage of an Object type in Oracle.
    I have a java program which calls an Oracle stored proc with the object's table type as IN parameter. In my stored proc, I am populating an Oracle Object with data received from java and retrieving some data based on that.
    My java program can be invoked concurrently by 500 users at the same time - the application is built to handle that request load.
    Now in Oracle, if a bunch of requests are received at the same, would Oracle create multiple instances of this object type that would be usage to the multiple stored proc invocations? Or would there be a prob of concurrency?
    If multiple instance creation is not supported, is there some alternative I can use?
    My code roughly resembles:
    Object:
    contains two columns - name, age
    Stored proc - logic to retrieve and return data from a table based on the name, age received.
    When a bunch of requests access the stored proc simultaneously, will a bunch of instnaces of the object type get created? Or would there be a scenario where the object is common to all requests and hence data from one request would be conflicted due to data from another request?

    Hi Wiiliam
    Sorry for the late acknowledgement (i dozed off!).. Thanks for the response. So the private instance specific to a session ensure that theres no conflict between multiple requests to the same stored proc and hence no conflict of data... Great
    Chaitanya

  • DatabaseMetaData for Oracle Object Types

    I have successfully written a Java program to read a schema - i.e. Tables, Primary Keys, Imported Keys, Exported Keys & Columns - using DatabaseMetaData. However, I need to decompose Oracle Objects.
    My test case is:
    SQL> desc object_column_table
    Name Null? Type
    ID NUMBER(11)
    TYP OBJ_COL_TYP
    SQL> desc obj_col_typ
    Name Null? Type
    VC VARCHAR2(255)
    NUM NUMBER(11)
    DT DATE
    CH CHAR(7)
    I believe I have found the method that I require:
    public void showAttributes(String schema, String typeName, String attribute)
    The JavaDoc says "Retrieves a description of the given attribute of the given type for a user-defined type (UDT) that is available in the given schema and catalog."
    However, this throws "java.sql.SQLException: Unsupported feature"
    My driver details are:
    Driver Name: Oracle JDBC driver
    Version: 10.1.0.2.0
    Major Version: 10
    Minor Version: 1
    JDBC Major Version: 10
    JDBC Minor Version: 1
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
    With the Partitioning, OLAP and Data Mining options
    So, how do I decompose Oracle Objects?
    Thanks in advance for your help.

    reynaudj,
    Try searching this forum's archives for the term "STRUCT". Perhaps also search the OTN Web site as well.
    Good Luck,
    Avi.

Maybe you are looking for

  • Small/medium business network upgrade

    Hello, I have been asked by a friend to do an upgrade to his business network.  I would appreciate any help and suggestions. There are several things which need to be accomplished: Implement a VPN solution for remote access Increase bandwidth to supp

  • OBIEE:  logical SQL to Physical sql conversion

    Hi, Is there any way i can get the physical sql from logical sql ( Apart from reading log file).. I am looking something like JAVA api which does that for us.. Do we have any mapping table which stores this mapping. Does the OBIEE provides any Java A

  • Is it still Nano only?

    I have a 30gb iPod video. I am wondering if the nike + is for nano only...if there is any way to get it onto iPod video please tell me.

  • Pdf viweing problem

    i am using acrobat jars to view a pdf file ,but i have a problem it will flikering when i scrolling to next page how i can solve this problem or plz send to me the url to get another pdf viewer jar files thanks and regards vipin

  • Photoshop Elements 11 Organizer will not open

    I have Windows 7. I have bought and installed Photoshop Elements 11. The Editor will open. The Organizer will not. I have tried uninstalling and re-installing and it remains the same.