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

Similar Messages

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

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

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

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

  • 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

  • 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

  • Problems launching Object Manager and Array Manager in SSGD 4.20.983

    Hi,
    I have just installed SSGD 4.20.983 in a server which is running Solaris 10. The language of this server is Spanish.
    When I access to the webtop, I 'm not be able to launch the applications Object Manager and Array Manager.
    When I try to launch them, in the details box appears "Contrase�a" and them the timeout expires. Contrase�a is the same that password in Spanish.
    Anyone can help me?
    Regards,
    Diego

    Do you have any logfiles which look like : execpePID_error.log?
    These files should contain more information.
    Also take a look at the following section of the Administration Guide: [http://docs.sun.com/source/820-6689/chapter4.html#d0e21816]
    Especially the part '+Increasing the Log Output+'
    - Remold

  • 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

  • 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

  • How to use an Object Type from Another Database

    Hi,
    I have this requirement that I need to call a stored procedure from another DB (db1) but I am having a problem with this because one of the input parameters uses an object type defined in that DB (db1). Is it possible to use an object type from another database? TIA!

    Sven W. wrote:
    At least for queries, but I think also for procedure arguments..You (both) probably missed my post?
    We can't use a remote type as procedure argument, even with the same OID.
    It's OK for query on a remote object column though :
    SQL> conn remote_user@remote_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> create table mytable (col1 mytype);
    Table créée.
    SQL> insert into mytable values (mytype(777));
    1 ligne créée.
    SQL> create or replace function myfunc (p_in in mytype) return number
      2  is
      3  begin
      4   return p_in.att1;
      5  end;
      6  /
    Fonction créée.
    SQL> disconn
    Déconnecté de Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> conn my_user@local_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> select * from mytable@test_dbl;
    COL1(ATT1)
    MYTYPE(777)
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype@test_dbl(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype@test_dbl(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 26 :
    PLS-00331: référence non valide à REMOTE_USER.MYTYPE@TEST_DBL.WORLD
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 9 :
    PLS-00306: numéro ou types d'arguments erronés dans appel à 'MYFUNC'
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored

  • 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

  • Using Multiple Object Types in a FIM Managed Criteria Distribution Group

    Is it possible to use multiple object types in a criteria based distribution group. So when building your criteria filter, "Select (object type) that match (all/any) of the following condiftions". Currently you can only choose 1 object type and
    I want to be able to choose object type "user" and a custom object type I create for my contacts 

    You can create main condition as "any" and later add two sub-conditions - one that object in set "All People" and other sub-condition that object in set "All Contacts" or "All Groups".
    If you found my post helpful, please give it a Helpful vote. If it answered your question, remember to mark it as an Answer.

  • How to trigger a form based on object type and process type

    Hi all,
    I am new into SRM.. I have been asked to develop a form by cloning an existing standard form..
    Using bbp_output_change_sf badi you can trigger the form by passing the object type but the scenario is such that depending on the object type and process type the new form should be triggered.
    The parameter iv_object_type passes the object type but how could i pass the process type ?
    In the badi I noticed an import parameter is_event that has a field called transction_type that carries the process type but this field never got populated when i checked using debugger.
    Please help as to how i can trigger the form based on the object_type and the process_type.
    Thanx in advance.

    Thanx again Jay Yang.. Well is there any possibility that you could get the items that were confirmed..
    Let me eleborate..
    Suppose in the PO u order an item for 10 nos and 5 gets confirmed and u return 2..
    Well in my case it is that i need to fill up a field Qty returned / Qty confirmed..
    I was able to get the number of items from the PO by passing the the passing the parameter to the FM "bbp_pd_conf_getdetaill"
    but i dont know how to get the number of items been confirmed..
    The quantity field in the line item structure gives me the number of items returned..
    Can u tell me how to get the number of items been confirmed....

Maybe you are looking for