Passing Object types using JDBC

I need to pass Oracle user-defined object types in and out of
PL/SQL stored procedures. Is this possible???
Thanks
null

Hi Tina,
I just had another thought. JDBC for 8.0 doesn't support
user-defined SQL types. This feature isn't implemented until 8i.
Sorry about the false lead!
So you'd have to wrapper your object in another PL/SQL method
which 'explodes' the user-defined type, as:
procedure can_call_from_jdbc (ename varchar2, empno number, ...)
is...
begin
call my_procedure(employee_t(ename, empno, ...));
end;
Pierre
Oracle Product Development Team wrote:
: Hi Tina,
: Yikes! I'm glad you asked; it made me realize that some info
: that's supposed to be posted on our external site is missing.
I
: think it'll take about a week to push this to our external
site.
: I'll try to find you a version and email it to you directly.
: Thanks!
: Pierre
: Tina Creighton (guest) wrote:
: : I'm currently using version 8.04 with Objects option, I'm
: trying
: : to locate the oracle.jpub class. Is there a way to download
: the
: : new jdbc that works with objects. Thanks. Tina
: : Oracle Product Development Team wrote:
: : : Absolutely!
: : : the easiest thing is first to use JPub to generate a Java
: : object
: : : which is an analogue to the SQL object you have. For
: example,
: : : if your SQL object is called 'EMPLOYEE_T', you can invoke
: JPub
: : : with:
: : : $ jpub -sql=employee_t -url=jdbc:oracle:oci8:@
: : -user=scott/tiger
: : : or even
: : : $ java oracle.jpub.Main -sql=employee_t
: -url=jdbc:oracle:oci8:@
: : : -user=scott/tiger
: : : This'll give you a Java class used to represent Java
: instances
: : of
: : : the SQL 'employee_t', featuring friendly setters and getter
: for
: : : the fields.
: : : If you have PL/SQL programs which take arguments of type
: : : employee_t, such as:
: : : PROCEDURE P1 (N NUMBER, E EMPLOYEE_T) IS...
: : : PROCEDURE P2 (N NUMBER, E OUT EMPLOYEE_T) IS...
: : : PROCEDURE P3 (N NUMBER, E IN OUT EMPLOYEE_T) IS...
: : : You can call them in a SQLJ program as:
: : : main () {
: : : employee_t e; // the class generated by JPub
: : : #sql {call P1(1, :e);}
: : : #sql {call P2(2, :out e);}
: : : #sql {call P3(3, :in out e);}
: : : to call your three PL/SQL procedures. After the call to P2
: and
: : : P3, your
: : : variable 'e' will be populated with the contents of the new
: : : employee_t value
: : : that was output from the PL/SQL method.
: : : (SQLJ is just a shorthand way of calling JDBC. SQLJ
programs
: : are
: : : translated
: : : into SQLJ programs by calling the "SQLJ Translator":
: : : $ sqlj myfile.sqlj
: : : Pierre
: : : Tina creighton (guest) wrote:
: : : : I need to pass Oracle user-defined object types in and
out
: of
: : : : PL/SQL stored procedures. Is this possible???
: : : : Thanks
: : : Oracle Technology Network
: : : http://technet.oracle.com
: Oracle Technology Network
: http://technet.oracle.com
Oracle Technology Network
http://technet.oracle.com
null

Similar Messages

  • I just installed Adobe InDesign CC 2014 and now I can't scale objects/type using Command+Shift Key. Has anyone else had this problem and if so, any solution?

    I just installed Adobe InDesign CC 2014 and now I can't scale objects/type using Command+Shift Key. Has anyone else had this problem and if so, any solution?

    There is a conflict with third party software or your system keyboard shortcuts. Lately, there have been many postings about conflicts with Chrome extensions so check there first.
    It's not a new problem. I wrote about it on InDesignSecrets.com in 2006:
    The Missing Keystrokes Mystery | InDesignSecrets

  • How to Convert OBJECT_TYPE to the Object Type Used for DBMS_METADATA?

    How do you convert the object type in ALL_OBJECTS to the object type that DBMA_METADATA.GET_DDL expects?
    Thanks,
    Kurz

    maybe one needs to find a mapping between sys.metaview$ and all_objects:
    SQL> select type, xmltag, udt, viewname from sys.metaview$ where type like '%PACKAGE%'
    TYPE                      XMLTAG                    UDT                       VIEWNAME                
    DE_S_PACKAGE                                                                                          
    DE_S_COMP_PACKAGE                                                                                     
    DE_S_COMP_PACKAGE2                                                                                    
    DE_S_COMP_PACKAGE_SPEC                                                                                
    DE_S_PACKAGE_BODY1                                                                                    
    DE_S_PACKAGE_BODY                                                                                     
    SE_PACKAGE                                                                                            
    SE_COMP_PACKAGE                                                                                       
    SE_COMP_PACKAGE2                                                                                      
    SE_COMP_PACKAGE_SPEC                                                                                  
    SE_PACKAGE_BODY                                                                                       
    PACKAGE                   PACKAGE_T                 KU$_PROC_T                KU$_PKG_VIEW            
    PACKAGE                   PACKAGE_BODY_T            KU$_PROC_T                KU$_PKGBDY_VIEW         
    PACKAGE                   FULL_PACKAGE_T            KU$_FULL_PKG_T            KU$_FULL_PKG_VIEW       
    PACKAGE_SPEC              PACKAGE_T                 KU$_PROC_T                KU$_PKG_VIEW            
    PACKAGE_BODY              PACKAGE_BODY_T            KU$_EXP_PKG_BODY_T        KU$_EXP_PKG_BODY_VIEW   
    ALTER_PACKAGE_SPEC        ALTER_PACKAGE_SPEC_T      KU$_ALTER_PROC_T          KU$_ALTER_PKGSPC_VIEW   
    ALTER_PACKAGE_BODY        ALTER_PACKAGE_BODY_T      KU$_ALTER_PROC_T          KU$_ALTER_PKGBDY_VIEW   
    18 rows selected.

  • Inserting oracle objects / collection using JDBC

    Hi people,
    I want to insert objects with collections(nested tables) into oracle database using my java JDBC. I believe there are two ways, one using strong types and the other as weak. I am using the weak types.
    This is what I have got so far:
    create or replace type town_ty as object(
    name varchar2(20)
    create or replace type country as object (
    name varchar2(20),
    towns town_ty
    create table country_tab of country_ty;
    Can any one kindly give or show me an example how to insert data into the above table using weak typed JDBC?
    Thanks very much

    Hi
    You should find what you are looking for in the samples provided here http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.html.
    HTH
    Chris

  • How to pass pricing type using BAPI_SALESORDER_CHANGE

    Hi all,
    How will we use BAPI_SALESORDER_CHANGE  to re-price the orders.
    There is parameter LOGIC_SWITCH  which can be used to export the pricing type.
    But what all are the other parameters we should pass?
    Has anybody worked in such a context.?

    Hi , Here is what you should pass to update the pricing with a particular pricing type :
    1)  SALESDOCUMENT = your sales order number
    2) ORDER_HEADER_INX-UPDATEFLAG = 'U'
    3)  LOGIC_SWITCH-PRICING =  "your value"
    4 ) *order_item_in-itm_number = * the item number for which pricing should be triggered
    5) *order_item-inx-ITM_NUMBER   = * the item number for which pricing should be triggered
    6) *order_item-inx-UPDATEFLAG   = * 'U'
    regards,
    Advait

  • Passing object type as parameters

    HI All,
    I am having a procedure as parameters below
    Procedure xyz( one in Varchar2
    two in Varchar2
    three in inv_abc_obj
    four out inv_def_obj);
    No i need to run this procedure as stand alone.
    The object inv_abc_obj is again of type inv_abc_obj as objecct ( main_obj_type xx_itm_main_obj
    sub_obj_type xx_tst_main_obj)
    Can any one help me out how to execute the procedure xyz
    Thanks in Advance

    somtheing like this.
    create or replace type t_type as object(
    npid number,
    ffid number,
    str varchar2(200));
    create or replace type tbl_type as table of t_type;
    create or replace
    procedure xyz(one in varchar2,two in varchar2, three in tbl_type, four out tbl_type)
    as
    begin
    four:=three;
    end;
    declare
    three tbl_type :=tbl_type();
    four  tbl_type :=tbl_type();
    begin
    three.extend(1);
    three(1) := t_type(1,2,'TEST');
    xyz(1,2,three,four);
    dbms_output.put_line(four(1).str);
    end;
    /

  • How could I Encrypt the data of SDO_GEOMETRY type using DBMS_CRYPTO package

    Hi:
    I want to Encrypt the data of SDO_GEOMETRY object type using DBMS_CRYPTO package.
    What could I do? hope anyone can help me,give me a suggestions!
    thanks in advance.
    lgs

    well, the spatial api would not be able to handle this data anymore, so what you are trying to do is converting an SDO_GEOMETRY to some cryptable user type (see http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm#sthref1506) and encrypting this.
    Before using the SDO_GEOMETRY type will have to decrypt and reconvert it again and pass it to the spatial query or function.

  • 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

  • Bind problem for varchar2 of object type??

    Hello all,
    I am trying out binding Oracle Object types to java object types using the SQLData interface.
    I created a simple object type called employee with the syntax
    create type employee as object (empName varchar2(50),empNo number(9));
    I then created a class called EmplyoeeObj which implements the interface. The code for the readSQL and
    writeSQL methods are below:
    public void readSQL(SQLInput stream, String typeName) throws SQLException {
    empName = stream.readString();
    empNo = stream.readInt();
    public void writeSQL(SQLOutput stream) throws SQLException {
    stream.writeString(empName);
    stream.writeInt(empNo);
    empName is a String and empNo is an int. The code that does the calling is:
    String query = "{call test_employee(?)}";
    Map map = connection.getTypeMap();
    map.put("CISWEB.EMPLOYEE",
    Class.forName("test.jdbc.EmployeeObj"));
    /*Set back the type map with the new mappings*/
    connection.setTypeMap(map);
    /*Create a statement to make the call */
    ocs = (OracleCallableStatement)connection.prepareCall(query);
    ocs.registerOutParameter(1,
    OracleTypes.STRUCT,
    "CISWEB.EMPLOYEE");
    boolean isWorked = ocs.execute();
    System.out.println("Execute finished........");
    Object outParam = ocs.getObject(1);
    System.out.println("Object was obtained........" + outParam);
    System.out.println("name:" + ((EmployeeObj)outParam).getName());
    As can be seen I have created a stored procedure which has one out parameter. All
    this preocedure does is assign an Employee object to the out parameter with a name of
    'Alex' and an employee number of 9.
    The code runs and all but I get this strange result. In the print I am getting the employee number
    coming out correctly but the employee name comes out as 3 question marks. I can't understand why
    "Alex" does not out. I have tried different things such as adding a new varchar2 to the object type and new a new integer and what I observer is that I keep getting 3 question marks coming back instead of whatever I assign for the employee name. Could someone please help and let me know what could be wrong?
    I have no clue as what is causing this weird behaviour.
    Thanks.

    Hi,
    i have not really a idea. But at the next step i would
    try the same procedure with in/out parameter and use a
    initialized string. Maybe there is a problem to
    determine the length of string.
    Bye ThomasThanks for you reply Thomas,
    This is the code for stored procedure that I use. As can be seen I just assign an employee to the
    out parameter.
    CREATE OR REPLACE PROCEDURE test_employee(emp out EMPLOYEE) IS
    BEGIN
         emp := EMPLOYEE('Alex',49);
    END;
    Now in the java code when the statement >>
    System.out.println("name:" + ((EmployeeObj)outParam).getName());
    executes I get the name coming out as the String: "???". That is three question marks. It is very weird. I then attempted to create the object using JPublisher and I get the same result. I attempted not only to use hte SQLData interface but Oracle's ORAData interfaces as well. I went to to create a table with column as the EMPLOYEE type and use in insert to put the same object and and then sellect * from the table to the the and I still get the 3 question marks for the name and the number comes out correctly.
    I am not sure what could be causing the text to come out as three question marks. I am using Oracle 9.2.0.4.0 and the ojdbc_g.jar drivers version :9.2.0.3.0. Any help would be greatly appreciated.
    Thanks

  • Passing Object parameters to Procedures in Oracle

    Hi,
    Can any one please provide me with a sample example how to pass object types as parameters (IN) to a procedure/package.
    Thanks in Advance.

    Here is a simple example
    SQL> create or replace type tbl as table of number
      2  /
    Type created.
    SQL> create or replace procedure proc(pTbl tbl)
      2  as
      3  begin
      4     for i in 1..pTbl.count
      5     loop
      6             dbms_output.put_line(pTbl(i));
      7     end loop;
      8  end;
      9  /
    Procedure created.
    SQL> exec proc(tbl(1,2,3,4,5))
    1
    2
    3
    4
    5
    PL/SQL procedure successfully completed.

  • 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

  • New custom object type - SWO1

    Hi All,
    I need to create a custom object type using SWO1.
    The object type needs to be linked to a report program with selection screen(or its tcode). 
    The selection screen carries just 1field. The output is a new screen.
    Would appreciate if any1 can tell me the step-by-step process to accomplish my objective.
    -Ram.

    Enter a name.
    Hit create. Populate the manadatory pop ups don't populate super type.
    Blow out the key field. Create a key field.
    Blow out the methods - add a method. Add the code for the method - select the method and hit the program button add code as below:
    BEGIN_METHOD RUNDUPREPORT CHANGING CONTAINER.
       SET PARAMETER ID 'VPA' FIELD OBJECT-KEY-PARTNEREMPLOYEEID.
    export object-key-partneremployeeid to memory id '99'.
       CALL TRANSACTION 'ZEML' AND SKIP FIRST SCREEN.
    *object-key-partneremployeeid.
    END_METHOD.
    Create your event.
    My method calls an abap I wrote that is bound to a transaction.
    You will need to set the release status for all of the elements of your object and the object itself.
    The question I have is why. Are you calling the object in a workflow? If so you will need to use the fm as below:
    DATA: OBJTYPE LIKE SWETYPECOU-OBJTYPE VALUE 'ZRM_WWCONT',
        EVENT LIKE SWETYPECOU-EVENT VALUE 'DuplicateEmail',
         OBJKEY LIKE SWEINSTCOU-OBJKEY,
            EVENTID LIKE SWEDUMEVID-EVTID.
        DATA: BEGIN OF EVENT_CONTAINER OCCURS 0.
                INCLUDE STRUCTURE SWCONT.
        DATA: END OF EVENT_CONTAINER.
        OBJKEY = KNVK-PARNR.
        CALL FUNCTION 'SWE_EVENT_CREATE'
             EXPORTING
                  OBJTYPE              = OBJTYPE
                  OBJKEY               = OBJKEY
                  EVENT                = EVENT
            START_WITH_DELAY     = ' '
            START_RECFB_SYNCHRON = ' '
            IMPORTING
                 EVENT_ID             = EVENTID
             TABLES
                  EVENT_CONTAINER      = EVENT_CONTAINER
             EXCEPTIONS
                  OBJTYPE_NOT_FOUND    = 1
                  OTHERS               = 2.
        COMMIT WORK.
    Good Luck.

  • Get object type attribute value

    1 am trying binding Oracle Object types to java object types using the ORAData interface.
    I created a simple object type called att_mesg_type with the syntax
    create type att_mesg_type as object (subject varchar2(200),Text varchar2(1000));
    I then created a class called attMesgType using Jpublisher which implements the interface.
    The getSubject() and getText() method return '???'.
    Anybody has any insights? Any inputs are appreciated.

    declare
    attr_name varchar2(10) := 'ATTR1';
    attr_value varchar2(50);
    type_instance MyType := MyType('VALUE 1', 'VALUE 2');
    begin
        execute immediate 'declare type_instance MyType := :1; begin :2 := type_instance.' || attr_name || '; end;'
          using type_instance,out attr_value;
        dbms_output.put_line(attr_value);
    end;
    VALUE 1
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Passing object with NIO

    HI All
    I am trying to figure out if we can pass objects when using NIO.
    If anyone has any idea about this please let me know
    Thanks and Regards
    Pankaj Tiwari

    Very tricky. If you are in non-blocking mode you will have to prepend a length word. Generally the idea is to serialize the object to a ByteArrayOutputStream, then write its length and its data to the channel. At the other end, read the length word, then read that many bytes into a byte array, wrap that in a ByteArrayInputStream, then deserialize from that.

  • Object type create

    Hi!
    I want to create new object type using trans SWO1.
    When i try to create for example object type ZEMP_NEW , i need also the supertype.
    I want to create new buisness object witout using existing one or with delegation.
    How do i do it?
    Do i miss something?
    regards
    yifat

    hi,
    Check this SAP help link,
    http://help.sap.com/saphelp_nw2004s/helpdata/en/4f/5668735cf211d194a30000e82dec10/frameset.htm
    rgds
    anver
    if hlped mark points

Maybe you are looking for

  • External firewire drive won't mount

    I've got an external Western Digital firewire drive that's been somewhat flaky recently, and today my Mac won't mount it. When I open Disk Utilities, I can see the drive (along with the other drives daisy chained together). When I click on "mount," I

  • Please help...IDOC_BPM_FILE error

    Hi gurus, I am trying to send IORDER01(pm order) from an R/3 system to a file, which works fine. but when i try to use some business logic like if order type = 'PM01' then only i have to write to the file, using ccBPM, it fails... this is my first BP

  • Error in sequence jobs run in backround

    Hi All, I am getting problem while submitting the bacground in sequence. i need to execute the jobs in loop. i have put the logic loop at (no. of jobs) CALL FUNCTION 'JOB_OPEN'   EXPORTING     jobname                  = l_f_jobname    SDLSTRTDT      

  • Ukelele generated custom keyboard layouts not working in Lion?

    I asked this question in the stackexchange site a few days ago.  Nothing I've tried has worked so far, except for creating a new account.  Because a fresh account works, it's got to be something with my preferences, right? http://apple.stackexchange.

  • My N900 suddenly wont connect to my '3' internet w...

    My N900 has been working fine but suddenly today wont connect to the net with my ' SIM It connects fine with my Virgin SIM, & the 3 SIM works fine with the internet on my N96 What could have happened?? Help!!!