Create user defined type under SQL type

Hello guys,
I have a table PART_NEEDED and a table function which returns table of PART_NEEDED%ROWTYPE. This works fine but if I try to create new user defined type with with the same attributes as PART_NEEDED and pipe the rows into table of that type I am getting an inconsistency of types error - Error(30,16): PLS-00382: expression is of wrong type.
Please refer to the script below. I appreciate any help!
CREATE TABLE "TOSS"."PART_NEEDED"
"PART_NEEDED_ID" NUMBER NOT NULL ENABLE,
"TYPE_OF_PART_NEEDS_ID" NUMBER,
"TYPE_OF_PART_IS_NEEDED_ID" NUMBER,
"AMOUNT" NUMBER
SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
TABLESPACE "USERS" ;
CREATE OR REPLACE TYPE "TYPE_PART_NEEDED" AS OBJECT
ID NUMBER,
PART_ID NUMBER,
SUB_PART_ID NUMBER,
AMOUNT NUMBER
create or replace package KOLEV_ADMIN_PKG as
TYPE TYPE_PART_NEEDED_TBL IS TABLE OF TOSS.TYPE_PART_NEEDED; -- if the type here is PART_NEEDED%ROWTYPE it works perfectly fine
FUNCTION GET_SUBPARTS (IN_PART_ID IN NUMBER)
RETURN TYPE_PART_NEEDED_TBL PIPELINED;
end;
CREATE OR REPLACE PACKAGE BODY "KOLEV_ADMIN_PKG" AS
FUNCTION GET_SUBPARTS (IN_PART_ID IN NUMBER)
RETURN TYPE_PART_NEEDED_TBL PIPELINED
IS
R_TBL TYPE_PART_NEEDED_TBL; -- To be returned
BEGIN
FOR R IN (
WITH
SUBPARTS(ID, PART_ID, SUBPART_ID, AMOUNT) AS
SELECT PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT
FROM PART_NEEDED
WHERE TYPE_OF_PART_NEEDS_ID = IN_PART_ID
UNION ALL
SELECT PN.PART_NEEDED_ID, PN.TYPE_OF_PART_NEEDS_ID, PN.TYPE_OF_PART_IS_NEEDED_ID, PN.AMOUNT
FROM SUBPARTS SP, PART_NEEDED PN
WHERE PN.TYPE_OF_PART_NEEDS_ID = SP.SUBPART_ID
SELECT SP.ID, SP.PART_ID, SP.SUBPART_ID, SP.AMOUNT
FROM SUBPARTS SP
ORDER BY PART_ID
LOOP
PIPE ROW(R); -- Error(30,16): PLS-00382: expression is of wrong type
END LOOP;
RETURN;
END GET_SUBPARTS;
END "KOLEV_ADMIN_PKG";
INSERT INTO "TOSS"."PART_NEEDED" (PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT) VALUES ('4', '2', '3', '2')
INSERT INTO "TOSS"."PART_NEEDED" (PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT) VALUES ('5', '3', '1', '2')
INSERT INTO "TOSS"."PART_NEEDED" (PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT) VALUES ('3', '2', '1', '4')
INSERT INTO "TOSS"."PART_NEEDED" (PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT) VALUES ('17', '3', '4', '1')
Database Release 11.2.0.1.0
I want this functionality because I need to make some joins and add descriptions for each part. Now this table PART_NEEDED contains only IDs - many to many.
Regards!
Edited by: Todor Kolev on Mar 3, 2012 12:47 PM

CREATE OR REPLACE
  PACKAGE BODY KOLEV_ADMIN_PKG
    AS
      FUNCTION GET_SUBPARTS (IN_PART_ID IN NUMBER)
        RETURN TYPE_PART_NEEDED_TBL PIPELINED
        IS
        BEGIN
            FOR R IN (
                      WITH SUBPARTS(ID, PART_ID, SUBPART_ID, AMOUNT)
                        AS (
                             SELECT  PART_NEEDED_ID,
                                     TYPE_OF_PART_NEEDS_ID,
                                     TYPE_OF_PART_IS_NEEDED_ID,
                                     AMOUNT
                               FROM  PART_NEEDED
                               WHERE TYPE_OF_PART_NEEDS_ID = IN_PART_ID
                            UNION ALL
                             SELECT  PN.PART_NEEDED_ID,
                                     PN.TYPE_OF_PART_NEEDS_ID,
                                     PN.TYPE_OF_PART_IS_NEEDED_ID,
                                     PN.AMOUNT
                               FROM  SUBPARTS SP,
                                     PART_NEEDED PN
                               WHERE PN.TYPE_OF_PART_NEEDS_ID = SP.SUBPART_ID
                      SELECT  TYPE_PART_NEEDED(
                                               SP.ID,
                                               SP.PART_ID,
                                               SP.SUBPART_ID,
                                               SP.AMOUNT
                                              ) O
                        FROM  SUBPARTS SP
                        ORDER BY PART_ID
                     ) LOOP
              PIPE ROW(R.O);
            END LOOP;
            RETURN;
      END GET_SUBPARTS;
END KOLEV_ADMIN_PKG;
/SY.

Similar Messages

  • How to create user defined metrics for SQL Server target?

    The customer is not able to create a user defined metrics for SQL Server target.
    This is very important for him to use this product.
    He is asking how to create user defined metrics?
    I sent him Note 304952.1 How to Create a User-Defined SQL Metric in EM 10g Grid Control
    But it would work for an Oracle DB, but his target is SQL Server DB
    Not able to find the "User-Defined Metrics" link from Database home page.
    How to create user defined metrics for SQL Server target?

    http://download-uk.oracle.com/docs/cd/B14099_19/manage.1012/b16241/Monitoring.htm

  • Create user-defined type

    Can I create a user-defined type with a range between 1 to 10.
    e.g. insert into table values (udt(11)) will prompt an error

    You will need to either provide different names for the
    constraints or let the system provide the names, like this:
    SET     ECHO OFF
    SET     FEEDBACK OFF
    SET     PAGESIZE 0
    SPOOL   add_constraints.sql
    SELECT 'ALTER TABLE ' || table_name
       || ' ADD CHECK (udt BETWEEN 1 AND 10);'
    FROM    user_tab_columns
    WHERE   column_name = 'UDT';
    SPOOL   OFF
    SET     PAGESIZE 24
    SET     FEEDBACK ON
    SET     ECHO ON
    START   add_constraints

  • Error when creating user defined TYPE

    Hi
    I have an object type created as follows
    create type emp_add is object(empno number(3),street varchar2(50),zipcode number(6));
    when I create a type based on the Object created above using
    create type add_rec is emp_add;
    I am getting compilation error
    SQL> sho err
    Errors for TYPE ADD_REC:
    LINE/COL ERROR
    1/17 PLS-00103: Encountered the symbol "EMP_ADD" when expecting one of
    the following:
    array VARRAY_ table object fixed varying opaque sparse
    How can I get rid of this error.I am a Beginner in Oracle database development.
    Thanks in advance

    Do this ->
    satyaki>
    satyaki>create type emp_add is object(empno number(3),street varchar2(50),zipcode number(6));
      2  /
    Type created.
    Elapsed: 00:00:07.77
    satyaki>
    satyaki>create or replace type add_rec as table of emp_add;
      2  /
    Type created.
    Elapsed: 00:00:00.96
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • Creating user defined function in sql server 2000

    I have created a udf an i want to call it in another udf. will u please help me out how to create.
    thank you

    And you ask that in an ORACLE forum? Brilliant idea... ;)

  • Is it possible to create user defined metrics in Grid Control 10.2.0.1 ?

    Hi,
    Is it possible to create user defined metrics(my SQL statement) in Grid Control 10.2.0.1
    (not 10.2.0.3) Linux/AIX ?
    Łukasz

    I am not sure if I am correct, but for reasons best known to them, Oracle replaced rather than add.
    Even if you want to do a smart search using the part# (e.g B16242-03) in oracle.com, you get a whole list of results, but when you click on them, you get http://www.oracle.com/errors/404.html
    I found this copy http://www.oracle.polcreate.pl/em.102/b16242/toc.htm

  • Issue in passing Oracle User Defined Types to PL SQL from Websphere Applica

    HI,
    I am facing an issue when trying to pass Oracle collection object(User Defined Types) from Java to PL SQL. The issue happens inside J2EE application which is running inside Websphere Application Server 6.x. My database is Oracle 10g and i am using ojdbc1.4.jar as thin driver.
    The issue is that when i pass the Oracle Object from java side, the attribute values of the collection objects at the Oracle PL SQL side is coming as empty. I have tried the same java code in a standalone application and it works fine. The issue happens only when the application is running inside WAS.
    Anybody has any idea how to pass Oracle User Defined Types from WAS 6.x server to Oracle PL SQL?

    Andy Bowes wrote:
    Hi
    I am using WebLogic 8.14 & Oracle 9i with thin JDBC driver.
    Our application needs to perform the same DB operation for every item in a Java Collection. I cannot acheive the required performance using the standard Prepare & Execute loop and so I am looking to push the whole collection to Oracle in a single invocation of a Stored Procedure and then loop on the database.
    Summary of Approach:
    In the Oracle database, we have defined a Object Type :
    CREATE OR REPLACE
    TYPE MYTYPE AS OBJECT
    TxnId VARCHAR2(40),
    Target VARCHAR2(20),
    Source VARCHAR2(20),
    Param1 VARCHAR2(2048),
    Param2 VARCHAR2(2048),
    Param3 VARCHAR2(2048),
    Param4 VARCHAR2(2048),
    Param5 VARCHAR2(2048),
    and we have defined a collection of these as:
    CREATE OR REPLACE
    TYPE MYTYPE_COLLECTION AS VARRAY (100) OF MYTYPE
    There is a stored procedure which takes one of these collections as an input parameter and I need to invoke these from within my code.
    I am having major problems when I attempt to get the ArrayDescriptor etc to allow me to create an Array to pass to the stored procedure. I think this is because the underlying Oracle connection is wrapped by WebLogic.
    Has anyone managed to pass an array to an Oracle Stored procedure on a pooled DB connection?
    Thanks
    AndyHi. Here's what I suggest: First please get the JDBC you want to work in a
    small standalone program that uses the Oracle thin driver directly. Once
    that works, show me the JDBC code, and I will see what translation if
    any is needed to make it work with WLS. Will your code be running in
    WebLogic, or in an external client talking to WebLogic?
    Also, have you tried the executeBatch() methods to see if you can
    get the performance you want via batches?
    Joe

  • Dose oracle.sql.ArrayDescriptor support the user defined type in package?

    Hi folks:
    I get a obstacle in calling stored procedure by using JDBC driver (ojdbc14.jar).
    I have the following code:
    create or replace package xxx AS
    type var_table is table of varchar2(50);
    procedure(parameter in var_table);
    end xxx;
    When I use the jdbc driver try to create a type for
    oracle.sql.ArrayDescriptor arrayDes = oracle.sql.ArrayDescriptor.createDescriptor( "var_table ",connection);
    The SQLException is thrown out like those:
    Invalid name pattern:user_schema. var_table
    So, my question is : Dose oracle.sql.ArrayDescriptor not support the user defined type in package? And I also tried to define such type by using sql "create xxxx" outside of package, then there is no SQLException.
    Hopefully for your response and suggestion.Thanks...

    To my knowledge, the Oracle JDBC driver does not support using the ArrayDescriptor for array data types (varray or nested table) that are defined inside of a package. The same is true for StructDescriptor as well. If you want to use array and object data types, you must define them outside of a package. Then you'll be able to use the descriptors in your JDBC programs.

  • Object Diagrams that support user define type (create type....and subtypes

    Hello it would be very nice to be able to use user define types in a diagram, at this time oracle, ibm db2 9 and sql server 2005 suport sql ansi 2003 and to use all this potential we have to take tecnology foward. My sugestion is create object diagram that can help design all this funtionability, rational rose has the oracle8 addin this will give you an exact idea of what i am asking.
    Thanks for your atention and let me know if you are planing to do this.
    Perhaps this is not the right forum please tell me where I can send this as a future requests

    JDeveloper has a UML class diagram with transformation into a Java class diagram - are you looking for anything beyond that?

  • PL/SQL and User Defined Types.....

    Hi All,
    I defined TEST_1 User Defined Type where VALUE_PART field is a VARCHAR2 type.
    TEST_1 is placed under sys so that everyone can use this type in Oracle 9i.
    CREATE TYPE TEST_1 AS OBJECT (
    VALUE_PART VARCHAR2(50),
    x NUMBER,
    y NUMBER
    This TEST_1 object type will be used as nested tables in the EMPLOYEE table where each attribute might require different bytes of VARCHAR2’s in the VALUE_PART field.
    CREATE TYPE NAME AS TABLE OF TEST_1;
    CREATE TYPE ADDRESS AS TABLE OF TEST_1;
    CREATE TYPE DEPARTMENT AS TABLE OF TEST_1;
    CREATE TABLE EMPLOYEE (
    SSN NUMBER,
    NAME TEST_1,
    ADDRESS TEST_1,
    DEPARTMENT TEST_1,
    SALARY NUMBER
    NESTED TABLE NAME STORE AS NAME_TABLE;
    NESTED TABLE ADDRESS STORE AS ADDRESS_TABLE;
    NESTED TABLE DEPARTMENT STORE AS DEPARTMENT_TABLE;
    Is it possible to specify VALUE_PART in the TABLE OF statement with different number of bytes?
    Is there any way to do that through methods or some other ways that I may not be aware of?
    For Example:
    /*This should allocate 10 bytes of VARCHAR2. */
    CREATE TYPE NAME AS TABLE OF TEST_1(10);
    /* and 30 bytes of VARCHAR2. */
    CREATE TYPE ADDRESS AS TABLE OF TEST_1(30);
    /*and 10 bytes of VARCHAR2. */
    CREATE TYPE DEPARTMENT AS TABLE OF TEST_1(10);
    Any help is appreciated.
    Thanks a lot.

    TEST_1 is placed under sys so that everyone can use
    this type in Oracle 9i.that's just wrong on sooo many levels. don't EVER put anything in sys.
    put it under an appropriate user, grant it, even create a synonym for it.
    and how would putting it under sys make it "so that everyone can use" it? unless you put everything else under sys as well.

  • How to create a user defined type base on existing table

    Hi Everyone,
    Are there any way to create a user defined type base on existing table us as :
    CREATE OR REPLACE Type MyTable Is Table Of PART%ROWTYPE;
    where Part is a table.
    Regards,
    JDang

    Hi JDAng,
    Can't be done. %ROWTYPE is a PL/SQL construct, and as such cannot be used in SQL.
    Regards
    Peter

  • How to execute function takes user defined type parameters as input &output

    Hi All,
    I want to execute a function which takes user defined type as input & output parameters. But i don't know how to execute that function in pl/sql statements.
    CREATE TYPE T_INPUT AS OBJECT
    USER          VARCHAR2(255),
    APPLICATION     VARCHAR2(255),
    REFERENCE          VARCHAR2(30)
    ) NOT FINAL;
    CREATE TYPE T_ID UNDER T_INPUT
    E_ID                    VARCHAR2 (50),
    CODE                    VARCHAR2 (3),
    SERVICE                    VARCHAR2 (10),
    C_TYPE                    VARCHAR2 (1)
    ) NOT FINAL;
    CREATE TYPE T_OUTPUT AS OBJECT
         R_STATUS               NUMBER(10),
         E_DESC_LANG_1          VARCHAR2(1000),
         E_DESC_LANG_2          VARCHAR2(1000),
         A_REFERENCE          VARCHAR2(30)
    ) NOT FINAL;
    CREATE TYPE T_INFO UNDER T_OUTPUT
    E_INFO XMLTYPE
    CREATE FUNCTION Get_Dtls
    I_DETAILS IN T_ID,
    O_DETAILS OUT T_INFO
    RETURN NUMBER AS
    END;
    Here
    1. T_ID is an input parameter which is a combination of T_ID + T_INPUT,
    2. T_INFO is an output parameter which is a combination of T_INFO + T_OUTPUT.
    Here i'll assign the T_ID values.
    --- T_INPUT values
    USER          = "admin";
    APPLICATION     = "test";
    REFERENCE     = "null";
    ---- T_ID values
    E_ID               = "1234";
    CODE               = "TTT";
    SERVICE               = "NEW";
    C_TYPE = "P";
    Now i want to execute Get_Dtls function with T_ID,T_INFO parameters in pl/sql statements.
    I want to catch the E_INFO value from T_INFO type.
    How can i Do this ?
    Pls Help. Thanxs in advance.
    Anil.

    I am very new to this. New to Oracle, PL/SQL, OO programming or testing?
    set serveroutput on
    declare
      tst_obj ctype;
    begin
      tst_obj := pkg.proc(11);
      dbms_output.put_line('id='||tst_obj.id||'::code='||tst_obj.code||'::usage='||tst_obj.usage);
    end;
    /Generally I disapprove of the use of DBMS_OUTPUT (for just about anything) but it is sufficient to demonstrate the basic principle.
    Really you should start using proper testing practices, ideally with an automated test harness like QUTE.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • Calling Oracle stored procedure with out param of user define type from Entity Framework 5 with code first

    Guys i am using Entity Framework 5 code first (I am not using edmx) with Oracle and all works good, Now i am trying to get data from stored procedure which is under package but stored procedure have out param which is user define type, Now my question is
    how i will call stored procedure from entity framework
    Thanks in advance.

    I agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
    If you think you are going to get existing MS Stored Procedures  or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
    coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
    You could use the EF backdoor, call Oracle Command object and use the Packages,  if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
    That's about your best shot.
    http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx

  • Table OF user defined type in c#

    Hello
    I am running C# using Oracle (PL/SQL, provider ODP.NET
    11.1.0.6.20) and I have a procedure which at the moment returns a table of
    records. The code below demonstrates this.
    TYPE R_OutData_tab IS RECORD ( ... );
    TYPE OutData_tab IS TABLE OF R_OutData_tab INDEX BY BINARY_INTEGER;
    PROCEDURE PROPERTY_GET (tOutData OUT <packagename>.OutData_tab);
    Since .NET doesn't support Oracle records I'm looking into rewriting the
    procedure so that it returns a table of a user defined type instead. The
    code below demonstrates this.
    create type person_type as object (name varchar2(30), address varchar2(60),
    age varchar2(3));
    TYPE person_table IS TABLE OF odp_obj1_sample_person_type;
    PROCEDURE PERSONS_GET(out_persons OUT person_table);
    I know how to handle a single user-defined type in .NET returned from a
    Oralce procedure but what I need to do now is to receive a or pass table of a user
    defined type using procedure. Is this supported in .NET?

    Dear ,
    I have posted a similar kind of reply in one of the thread  which may help u defining the User Defined Tabel /Filed .Just check this Out :
    For cm25/CM21 : Assuming that you have all the other set up for Capacity Requirement in place , please note the belwo steps for layout design for CM25 OR cm21 or cm22( all you will be used same overall profile )
    1.Make sure that you have proper Overall profile defined in OPD0-Define Overall profile .Here u will define Time Profile , Startegy prfoile . Lay out Profile etc .
    2.To paint your layout your soultion is to Goto -CY38-Pop down the menu -Select the Lay out Key which have been used as lay out -Goto Change Mode (Pencil symbol)-Now you will find the fields are high ligheted as per CM25 dipaly in a sequnce -You can un chekcde the Filed like Operation , Operation text , Setup what ever you do not want to show in Order Pool and Hit SAVE butotn and come back .
    CM25 --> Settings --> Display Profiles --> Planning tab.profile --> I01 --> Layout ID ( Example : 'SAPSFCLA05') which is Main Capacity Lay out id .
    If you goto CY38-Pop down the menu -You will find Main Capcitity Lay out Id : Example SAPSFCAS01 -Enter this lay out and chenage accordingly as I have explained in above
    Once you save this , then go back to CM25 and execute with coupe of work centres to check how is the order pool looks now .
    Refer this threade for Layout Id and option which u may need for CM25 front end
    Exception messages in CM21 or CM25
    I hope this should work
    Regards

  • Access result set in user define type of table

    here is the situation. I have a stored procedure that dequeues messages of a AQ and passes them as an OUT parameter in a collection of a user defined type. The same type used to define the queues. The java code executes properly but seems like we don't/can't access the result set. We don't receive any erros but don't know how to access the results. I've included relevant parts of the problem.
    I know this should be doable but........Can someone please tell us what we are doing wrong....thanks in advance.
    -----create object type
    create type evt_ot as object(
    table_name varchar(40),
    table_data varchar(4000));
    ---create table of object types.
    create type msg_evt_table is table of evt_ot;
    ----create queue table with object type
    begin
    DBMS_AQADM.CREATE_QUEUE_TABLE (
    Queue_table => 'etlload.aq_qtt_text',
    Queue_payload_type => 'etlload.evt_ot');
    end;
    ---create queues.
    begin
    DBMS_AQADM.CREATE_QUEUE (
    Queue_name => 'etlload.aq_text_que',
    Queue_table => 'etlload.aq_qtt_text');
    end;
    Rem
    Rem Starting the queues and enable both enqueue and dequeue
    Rem
    EXECUTE DBMS_AQADM.START_QUEUE (Queue_name => 'etlload.aq_text_que');
    ----create procedure to dequeue an array and pass it OUT using msg_evt_table ---type collection.
    create or replace procedure test_aq_q (
    i_array_size in number ,
    o_array_size out number ,
    text1 out msg_evt_table) is
    begin
    DECLARE
    message_properties_array dbms_aq.message_properties_array_t :=
    dbms_aq.message_properties_array_t();
    msgid_array dbms_aq.msgid_array_t;
    dequeue_options dbms_aq.dequeue_options_t;
    message etlload.msg_evt_table;
    id pls_integer := 0;
    retval pls_integer := 0;
    total_retval pls_integer := 0;
    ctr number :=0;
    havedata boolean :=true;
    java_exp exception;
    no_messages exception;
    pragma EXCEPTION_INIT (java_exp, -24197);
    pragma exception_init (no_messages, -25228);
    BEGIN
    DBMS_OUTPUT.ENABLE (20000);
    dequeue_options.wait :=0;
    dequeue_options.correlation := 'event' ;
    id := i_array_size;
    -- Dequeue this message from AQ queue using DBMS_AQ package
    begin
    retval := dbms_aq.dequeue_array(
    queue_name => 'etlload.aq_text_que',
    dequeue_options => dequeue_options,
    array_size => id,
    message_properties_array => message_properties_array,
    payload_array => message,
    msgid_array => msgid_array);
    text1 := message;
    o_array_size := retval;
    EXCEPTION
    WHEN java_exp THEN
    dbms_output.put_line('exception information:');
    WHEN no_messages THEN
    havedata := false;
    o_array_size := 0;
    end;
    end;
    END;
    ----below is the java code....
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Struct;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    public class TestOracleArray {
         private final String SQL = "{call etlload.test_aq_q(?,?,?)}";//array size, var name for return value, MessageEventTable
         private final String driverClass = "oracle.jdbc.driver.OracleDriver";
         private final String serverName = "OurServerName";
         private final String port = "1500";
         private final String sid = "OurSid";
         private final String userId = "OurUser";
         private final String pwd = "OurPwd";
         Connection conn = null;
         public static void main(String[] args){
              TestOracleArray toa = new TestOracleArray();
              try {
                   toa.go();
              } catch (InstantiationException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IllegalAccessException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (ClassNotFoundException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (SQLException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         private void go() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException{
              Class.forName(driverClass).newInstance();
              String url = "jdbc:oracle:thin:@"+serverName+":"+port+":"+sid;
              conn = DriverManager.getConnection(url,userId,pwd);
              OracleCallableStatement stmt = (OracleCallableStatement)conn.prepareCall(SQL);
              //set 1 input
              stmt.setInt(1, 50);
              //register out 1
              stmt.registerOutParameter(2, OracleTypes.NUMERIC);
              //register out 2
              stmt.registerOutParameter(3, OracleTypes.ARRAY, "MSG_EVT_TABLE");
              * This code returns a non-null ResultSet but there is no data in the ResultSet
              * ResultSet rs = stmt.executeQuery();
              * rs.close();
              * Tried all sorts of combinations of getXXXX(1);
              * All return the same error Message: Invalid column index
              * So it appears that the execute statment returns no data.
              stmt.execute();
              Struct myObject = (Struct)stmt.getObject(1);
              stmt.close();
              conn.close();
    }

    Hi,
    Sorry but I'd refer you to the following sections (and code samples/snippets) in my book:
    Mapping User-Defined Object Types (AD) to oracle.sql.STRUCT in section 3.3, shows how to pass user defined types as IN, OUT,IN/OUT
    JMS over Streams/AQ in the Database: shows how to consume AQ
    message paylod in section 4.2.4
    CorporateOnine, in section 17.2, show how to exchanges user defined type objects b/w AQ and JMS
    All these will hopefully help you achieve what you are trying to do.
    Kuassi

Maybe you are looking for

  • How can I get my 'Transitions' to load in my new Premiere Elements 10?

    I just got Adobe Premiere Elements 10 and cannot get the transitions to load. Everything else in the Edit tab works fine, but when I click on Transitions it just says it's loading ... forever ... or will crash the program & close.  Is anyone else hav

  • BAPI_PO_CREATE1 Contract limits are not populated

    Hi I am trying to create a PO with reference to a p.requisition that has service limits (with the sum of 140.00 EUR) and to a purchase Contract in the the Contract Limits . I populated the following segments in the Bapi : POHEADER POHEADERX POITEM:  

  • How do I restore IE to use Reader for displaying PDF files?

    When I updated PDF Creator, it also updated PDF Architect which went and installed itself in IE as the PDF reader.  How do I change IE back to using Reader for displaying PDFs? In IE, I disabled the "PDF Architect Internet Explorer Previewer" under "

  • Saving a file with data?

    HI, I am wanting to save a file with data, can some one point me in the right direction to a tut or some thing. Thanks. OR if they could be so kind as to code a simple thing that saves a file (txt) with a word. This would make my day, Thansk and all

  • Sync in peferences

    I dont have sync in peference or when i right click on selected clips. Jim