ARRAYS in stored procedures?

is it possible to have an ARRAY be passed as an In and/or Out
Parameter in a stored procedure call? if so then can someone
please show me how? (ie what do i register as the Out, etc.) or
do i have to use a resultset to access it?
null

Artie (guest) wrote:
: is it possible to have an ARRAY be passed as an In and/or Out
: Parameter in a stored procedure call? if so then can someone
: please show me how? (ie what do i register as the Out, etc.)
or
: do i have to use a resultset to access it?
Yes u can pass array to a procedure.
I have created a package that stores the array
definition, and the procedure by name abc which takes an array as
out parameter (script proc1.sql)
and the second script proc2.sql calls the procedure abc and
prints some result
/*File proc1.sql*/
/*IT creates the package T with the definition of array
and passes to the procedure*/
CREATE OR REPLACE PACKAGE T as
TYPE arr_type is table of number index by binary_integer;
test_array arr_type;
END;
CREATE OR REPLACE PROCEDURE abc(t OUT T.arr_type ) IS
begin
for i in 1..10
loop
t(i) := i ;
end loop;
end abc;
/*End of Program proc1.sql*/
/*Program proc2.sql*/
/*This file calls the procedure abc and prints the result*/
declare
test_array T.arr_type;
begin
abc(test_array);
for i in 1..10 loop
dbms_output.put_line('Result '

Similar Messages

  • Trying to pass array to stored procedure in a loop using bind variable

    All,
    I'm having trouble figuring out if I can do the following:
    I have a stored procedure as follows:
    create procedure enque_f826_utility_q (inpayload IN f826_utility_payload, msgid out RAW) is
    enqopt dbms_aq.enqueue_options_t;
    mprop dbms_aq.message_properties_t;
    begin
    dbms_aq.enqueue(queue_name=>'f826_utility_queue',
    enqueue_options=>enqopt,
    message_properties=>mprop,
    payload=>inpayload,
    msgid=>msgid);
    end;
    The above compiles cleanly.
    The first parameter "inpayload" a database type something like the following:
    create or replace type f826_utility_payload as object
    2 (
    3 YEAR NUMBER(4,0),
    4 MONTH NUMBER(2,0),
    83 MUSTHAVE CHAR(1)
    84 );
    I'd like to call the stored procedure enque_f826_utility_q in a loop passing to it
    each time, new values in the inpayload parameter.
    My questions are:
    First, I'm not sure in php, how to construct the first parameter which is a database type.
    Can I just make an associative array variable with the keys of the array the same as the columns of the database type shown above and then pass that array to the stored procedure?
    Second, is it possible to parse a statement that calls the enque_f826_utility_q procedure using bind variables and then execute the call to the stored procedure in a loop passing new bind variables each time?
    I've tried something like the following but it's not working:
    $conn = oci_pconnect (....);
    $stmt = "select * from f826_utility";
    $stid = oci_parse($conn, $sqlstmt);
    $r = oci_execute($stid, OCI_DEFAULT);
    $row = array();
    $msgid = "";
    $enqstmt = "call enque_f826_utility_q(:RID,:MID)";
    $enqstid = oci_parse($conn, $sqlstmt);
    oci_bind_by_name($enqstid, ":RID", $row); /* line 57 */
    oci_bind_by_name($enqstid, ":MID", $msgid);
    while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC))
    ++$rowcnt;
    if (! oci_execute($enqstid)) /* line 65 */
    echo "Error";
    exit;
    When I run this, I get the following:
    PHP Notice: Array to string conversion in C:\Temp\enqueue_f826_utility.php on l
    ine 57
    Entering loop to process records from F826_UTIITY table
    PHP Notice: Array to string conversion in C:\Temp\enqueue_f826_utility.php on l
    ine 65
    PHP Warning: oci_execute(): ORA-06553: PLS-306: wrong number or types of argume
    nts in call to 'ENQUE_F826_UTILITY_Q' in C:\Temp\enqueue_f826_utility.php on lin
    e 65
    PHP Notice: Undefined variable: msgnum in C:\Temp\enqueue_f826_utility.php on l
    ine 68
    Error during oci_execute of statement select * from F826_UTILITY
    Exiting!

    Thanks for the reply.
    I took a look at this article. What it appears to describe is
    a calling a stored procedure that takes a collection type which is an array.
    Does anyone from Oracle know if I can pass other database type definitions to a stored procedure from PHP?
    I have a type defined in my database similar to the following which is not
    an array but a record of various fields. This type corresponds to a payload
    of an advanced queue payload type. I have a stored procedure which will take as it's input, a payload type of this structure and then enqueue it to a queue.
    So I want to be able to pass a database type similar to the following type definition from within PHP. Can anyone from Oracle verify whether or not this is possible?
    create or replace type f826_utility_payload as object
    YEAR NUMBER(4,0),
    MONTH NUMBER(2,0),
    UTILITY_ID NUMBER(10,0),
    SUBMIT_FAIL_BY VARCHAR2(30),
    MUSTHAVE CHAR(1)
    );

  • Using Parameterized Arrays in Stored Procedure

    I tried following code to pass array value to stored procedure but its giving error, as I am new to this procedure, please advise what am I missing ?
    Best Regards,
    Luqman
    My code is as below.
    CREATE TYPE num_array AS table of number;
    create or replace procedure give_me_an_array
    ( p_array in num_array )
    as
    begin
    for i in 1 .. p_array.count
    loop
    dbms_output.put_line( p_array(i) );
    end loop;
    end give_me_an_array;
    declare
    mdata num_array;
    begin
    mdata(1) := 1234;
    mdata(2) := 10;
    give_me_an_array(mdata);
    end;

    Hi Satya,
    Now I got it, thanks,
    Can you please advise, if I use the same stored procedure for EMP Table and use my array values to retrieve the selected EMPNo
    I tried following but I could not succeed.
    When I compile the stored procedure, error occurs:
    "inconsistent datatypes: expected NUMBER got NUM_ARRAY"
    for example:
    CREATE TYPE NUM_ARRAY AS TABLE OF NUMBER;
    Create or Replace Package TB_Data
    Is Type CV_Type Is REF CURSOR;
    END TB_DATA;
    Create or Replace Stored Procedure give_me_an_array
    (CV IN OUT TB_DATA.CV_TYPE,
    MEmpNo In Num_Array)
    Is
    Begin
    Open CV for
    Select * from EMP
    Where Empno in MEmpNo;
    End myProc;
    declare
    mdata num_array:=num_array(7839,7844);
    begin
    give_me_an_array(mdata);
    end;
    Best Regards,
    Luqman

  • How to use arrays in stored procedure??Please do help me.......

    hi, i need to make a procedure where i may execute a query.The query returns multiple rows.Now i want to use 1 row.i needs to fetch all colums as out parameter...can anyone please help me.....i will be very thankful to the person.

    you cannot just force only one column from a select statement to be a out parameter, you need to collect all the columns into a collection type and use the collection type as out parameter or use refcursor as out parameter and fetch the rows
    using collection type
    create type obj_typ is object(
    a_val number,
    b_val varchar2(100)
    create type nest_typ is table of obj_typ
    create or replace procedure retrieve_emp(mgr_no number,e_details out nest_typ) is
    begin
    select obj_typ(empno,ename) bulk collect into e_details from emp
    where mgr = mgr_no;
    end;
    declare
    nest_var nest_typ;
    begin
    retrieve_emp(7698,nest_var);
    for i in 1..nest_var.count loop
    dbms_output.put_line(nest_var(i).a_val || ' - '||nest_var(i).b_val);
    end loop;
    end;
    7499 - ALLEN
    7521 - WARD
    7654 - MARTIN
    7844 - TURNER
    7900 - JAMESUsing ref cursor
    create or replace procedure retrieve_emp2(mgr_no number,e_details out sys_refcursor) is
    begin
    OPEN e_details FOR select empno,ename from emp
    where mgr = mgr_no;
    end;
    declare
    empno_val emp.empno%type;
    ename_val emp.ename%type;
    edetails_ref_Cur sys_refcursor;
    begin
    retrieve_emp2(7698,edetails_ref_Cur);
    loop
    fetch edetails_ref_cur into empno_val,ename_val;
    exit when edetails_ref_cur%notfound;
    dbms_output.put_line(empno_val ||' - '||ename_val);
    end loop;
    close edetails_ref_cur;
    end;
    7499 - ALLEN
    7521 - WARD
    7654 - MARTIN
    7844 - TURNER
    7900 - JAMESHTH,
    Prazy

  • I want to pass String array to Stored procedure .

    ArrayDescriptor claim = ArrayDescriptor.createDescriptor("POOJA.VARCHAR_TBL" , conn);
    String test[] = {"an","jk"};
    ARRAY a = new ARRAY(claim,conn,test);
    cstmt.setArray(noOfParms,a);
    It gives class cast exception at ArrayDescriptor .. Dont know why ?
    Need an urgent help ...

    ArrayBinding feature is for bulk operation where a SP or SQL statement executes ArrayBindCount time in one server round trip. Each execution uses the nth element in the parameter (array) and execute the SP or SQL statement.
    This is done internally in the database, and not related to the SP or SQL statement at all.
    The PL/SQL Associative array support might be the feature that you're looking for.
    Please take a look from our Doc on these topics for further information. Also take a look in the ODP.NET dissucssion forum's samples section.
    Thanks
    Martha

  • Pass array to oracle stored procedure

    I have such a problem: I have to pass array to stored procedure, so I declare type:
    create type tNumberArray as table of number
    and create procedure:
    create or replace procedure proc_1 (in_param in tNumberArray) as
    .... BODY OF PROCEDURE ...
    when I call this procedure from C# like this:
    int []pParam = new int[3] {1,2,3};
    OracleCommand cmd = new OracleCommand("proc_1", dbConn);
    cmd.CommandType = CommandType.StoredProcedure;
    OracleParameter param14 = new OracleParameter("param", OracleDbType.Decimal);
    param14.Value = pParam;
    param14.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    param14.Size = 3;
    param14.Direction = ParameterDirection.Input;
    cmd.Parameters.Add(param14);
    cmd.ExecuteNonQuery();
    an error occures. It say that there invalid number or type of parameters.
    But when I declare both type and procedure in a package everything goes fine.
    What is the matter? Did anybody have the same problem?

    Not I got next problem:
    when I cannot pass parameter to stored procedure and get array fro it. In other words returning array from procedure and passing some input parameters to it does not word!
    Does anybody know why it happens?

  • How do i insert multiple blob files in Stored procedure using c#?

    i want to add multiple blob files to a stored procedure at one go.Thus i have a 2 dimensional byte array consisting of multiple blob files.How to i add this 2 dimensional array to stored procedure?

    Hi Jeff,
    I haven't tried to insert multiple images at a time, but have done it for single image at a time and composed article on it : BizTalk
    Server 2010: How to Insert Image In SQL Through Orchestration and sample can be found at : 
    BizTalk Server 2010: How to Insert
    Image In SQL Through Orchestration sample.
    I hope it helps.
    Maheshkumar S Tiwari|User
    Page | http://tech-findings.blogspot.com/

  • How to pass arry in stored procedure

    I want to pass an array thru a JDBC to a stored procedure
    how can i pass a java variable string array to the store procedure using JDBC.
    here is my package for array:
    CREATE OR REPLACE PACKAGE TABLE_TYPES
    AS
    TYPE tString IS TABLE OF VARCHAR2(10) INDEX BY BINARY_INTEGER;
    END;
    here is my store procedure:
    CREATE OR REPLACE PROCEDURE Declassification
    (P_COMPANY_ID IN SECURITY.COMPANY_ID%TYPE,
    P_SECURITY_NAME IN SECURITY.SECURITY_NAME%TYPE,
    P_SECURITY_SYMBOL IN SECURITY.SECURITY_SYMBOL%TYPE,
    P_CURRENCY IN SECURITY.CURRENCY%TYPE,
    P_ISIN IN SECURITY.ISIN%TYPE,
    P_LISTING_DATE IN VARCHAR2,
    P_SECTOR IN SECURITY.SECTOR%TYPE,
    P_INDUSTRY IN SECURITY.INDUSTRY%TYPE,
    P_PAR_VALUE IN VARCHAR2,
    P_PAR_VALUE_AS_OF IN VARCHAR2,
    P_BOARDLOT IN VARCHAR2,
    P_BOARDLOT_AS_OF IN VARCHAR2,
    P_MARKET_PRICE IN VARCHAR2,
    P_REQD_PUBLIC_OWN_PERC IN VARCHAR2,
    P_STATUS IN SECURITY.STATUS%TYPE,
    P_SECURITIES IN Table_Types.tString,
    P_ID OUT SECURITY.SECURITY_ID%TYPE)
    AS
    P_SECURITY_ID SECURITY.SECURITY_ID%TYPE;
         rec_count NUMBER;
    BEGIN
         SELECT COUNT(*)
         INTO rec_count
         FROM SECURITY;
         IF rec_count > 0 THEN
              SELECT MAX(TO_NUMBER(security_id)) + 1
              INTO P_SECURITY_ID
              FROM SECURITY;
         ELSE
              P_SECURITY_ID:=1;
         END IF;
              INSERT INTO SECURITY
              VALUES(P_SECURITY_ID, P_COMPANY_ID, P_SECURITY_NAME, P_SECURITY_SYMBOL, 'COMMON',
                        P_CURRENCY, P_ISIN, TO_DATE(P_LISTING_DATE,'mm/dd/yyyy'), P_SECTOR, P_INDUSTRY, TO_NUMBER(P_PAR_VALUE),
                        TO_DATE(P_PAR_VALUE_AS_OF,'MM/DD/YYYY'), TO_NUMBER(P_BOARDLOT), TO_DATE(P_BOARDLOT_AS_OF,'MM/DD/YYYY'),
                        TO_NUMBER(P_MARKET_PRICE), TO_NUMBER(P_REQD_PUBLIC_OWN_PERC), P_STATUS);
              INSERT INTO SECURITY_FINANCIAL(SECURITY_ID)
              VALUES (P_SECURITY_ID);               
              INSERT INTO SECURITY_TOTAL(SECURITY_ID)
                        VALUES (P_SECURITY_ID);
         COMMIT;
    END Declassification;

    I want to pass an array thru a JDBC to a stored
    procedure
    how can i pass a java variable string array to the
    store procedure using JDBC.
    here is my package for array:
    CREATE OR REPLACE PACKAGE TABLE_TYPES
    AS
    TYPE tString IS TABLE OF VARCHAR2(10) INDEX BY
    Y BINARY_INTEGER;
    END;
    There are two ways to pass in Arrays to stored procedures in Oracle:
    1. Define an Oracle TYPE outside a package and then use oracle.sql.ARRAY and oracle.sql.ArrayDescriptor to explain to the driver how the array is structured. This is what Avi has shown how to do.
    2. You can also pass in INDEX BY arrays of VARCHAR2 or NUMBER, provided they are indexed by BINARY_INTEGER. This is what you appear to want. In order to do this you'll probably need the 10g JDBC driver and code that uses the 'setPlsqlIndexTable' method of 'OraclePreparedStatement' to bind your array.
    Be careful about the values you pass into the 'setPlsqlIndexTable' method. You have to specify in advance how much data you expect to get back and how long each row is. The driver allocates memory based on these numbers. You code also needs to cope with arrays that have null elements.
    I work for a company that makes a JDBC code generator. A list of common situations we've encountered when working with Index By tables can be found here:
    http://www.orindasoft.com/public/PL-SQL%20Recordstwo.php4?siteloc=PL-SQL%20Recordstwo#probix
    David Rolfe
    Orinda Software
    Dublin, Ireland
    www.orindasoft.com
    Orinda Software makes OrindaBuild, which writes JDBC calls for PL/SQL and SQL.

  • REF CURSOR as IN parameter to stored procedure

    Currently, ODP.NET supports REF CURSOR parameter as OUT parameter only.
    Based on the project requirements it is necessary to pass
    multiple records to the stored procedure.
    In this case REF CURSOR as IN parameter is useful.
    What are the plans to implement REF CURSOR as IN parameter to stored procedure?
    What is the work around in case it is necessary to pass several different
    record types as arrays to stored procedure?

    ODP.NET does not limit REF Cursor parameters to IN parameters. This is a known PL/SQL limitation.
    An excerpt from Application Developer's Guide:
    "If you pass a host cursor variable to PL/SQL, you cannot fetch from it on the server side unless you also open it there on the same server call".

  • With JDBC, calling a stored procedure with ARRAY as out parameter

    Hi,
    I want to use the data type ARRAY as an out parameter in an Oracle stored procedure. I want to call the stored procedure from
    my java program using JDBC.
    The problem it's i use a 8.1.7 client to acces with oci to a 7.1.3 Database.
    With this configuration I can get back a Cursor but not an Array.
    Does it's possible ?
    Thanks for your help !
    Michakl

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • How to bind arrays to PL/SQL stored procedure using OCI?

    Hi,
    We are having problems trying to bind arrays to PL/SQL stored procedure using OCI. Here is the situation:
    - We have a stored procedure called "GetVEPFindTasks" with the following interface:
    PROCEDURE GetVEPFindTasks (
    p_ErrorCode OUT NUMBER,
    p_ErrorMsg OUT VARCHAR2,
    p_RowCount OUT NUMBER,
    p_VEPFindTasks OUT t_VEPFindTaskRecordTable,
    p_MaxTask IN NUMBER);
    t_VEPFindTaskRecordTable is a record with the following entries:
    TYPE t_VEPFindTaskRecord IS RECORD (
    RTCID NUMBER,
    TransNum NUMBER,
    TransTimestamp VARCHAR2(20),
    Pathname1 image_data.pathname%TYPE,
    Pathname2 image_data.pathname%TYPE,
    Pathname3 image_data.pathname%TYPE,
    OperatorID operator.id%TYPE);
    - Now, we are trying to call the stored procedure from C++ using OCI (in UNIX). The call that we use are: OCIBindByName and OCIBindArrayOfStruct to bind the parameters to the corresponding buffers. We bind all parameters in the interface by name. Now, we do bind the record's individual item by name (RTCID, TransNum, etc.), and not as a record. I don't know if this is going to work. Then, we use the bind handles of the binded record items (only record items such as RTCID, TransNum, and NOT error_code which is not part of the record) to bind the arrays (using OCIBindArrayOfStruct).
    All of the parameters that are binded as arrays are OUTPUT parameters. The rest are either INPUT or INPUT/OUTPUT parameters. Now, when we try to execute, OCI returns with an error "Invalid number or types of arguments" (or something to that sort... the number was something like ORA-06550). Please help...
    Is there any sample on how to use the OCIBindArrayOfStruct with PL/SQL stored procedures? The sample provided from Oracle is only for a straight SQL statement.
    Thank's for all your help.
    ** Dannil Chan **

    As you said:
    You have to pass in an array for every field and deconstruct/construct the record in the procedure. There is no support for record type or an array of records. Can you give me a example? I'am very urgently need it.
    thanks
    email: [email protected]

  • How to send a Varying Array param to a PL/SQL Stored Procedure from Java

    * I am VERY new to jdbc, and even somewhat new to Java
    * I'm using Java 1.5, Oracle 10g.
    * I need to call the following PL/SQL Stored Procedure from Java:
    procedure setEventStatus
    i_deQueueStatus in deQueueStatus_type
    *deQueueStatus_type is the following (an array of deQueueStatus_OBJ):
    CREATE OR REPLACE TYPE deQueueStatus_OBJ as object
    eventID number (20),
    dequeuestatus varchar2(20)
    CREATE OR REPLACE TYPE deQueueStatus_TYPE IS VARYING ARRAY(500) of deQueueStatus_obj
    *I have created a Java object as follows:
    public class EventQueueDeQueueStatus
         long      eventID;
         String      dequeueStatus;
         EventQueueDeQueueStatus(long eventID, String dequeueStatus)
              this.eventID = eventID;
              this.dequeueStatus = dequeueStatus;
    I have an ArrayList of these.
    I need to pass this list to the Stored Procedure. How do I create a java.sql.Array so I can call CallableStatement.setArray to set the parameter? Or do I use something else? I have tried setObject with both the ArrayList and also with a primitive array, but got "Invalid Column Type" both times.
    Any help would be greatly appreciated. I just got this task today, and I have to make it work by Tuesday :-( !
    Thanks,
    Kathy

    Kathy,
    Search the archives of this forum and the JDBC forum for the terms STRUCT and ARRAY and you can find some sample code on the JDBC How-To Documents page and the JDBC Samples which can both be accessed from this page:
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/index.html
    Good Luck,
    Avi.

  • Calling a stored procedure with array as IN parameter

    Hi,
    I need to invoke a stored procedure which actually requires 2 IN parameters , both are ARRAY of numbers.. Can anyone tell me using JDBC callableStatement how to invoke this stored procedure?
    how to pass array of numbers as input to stored procedure? also what is the corresponding JAVA data type?
    the procedure definition is as follows:
    PROCEDURE update_group
    ( in_username IN consumers.consumer_name%type,
    in_group_id IN account_group.acct_grp_id%type,
    in_group_name IN account_group.acct_grp_dsply_nm%type,
    in_group_type IN account_group.acct_group_type_cd%type,
    in_rem_accts_arr IN number_array,
    in_add_accts_arr IN number_array,
    out_over_max_ind OUT integer);
    thanks in advance

    Hi,
    You need to define a Call Spec like the following (assume NVarrayClass class):
    create or replace procedure nvaproc (x IN OUT number, y IN OUT
    NVARRAY,
    z IN NVARRAY)
    as language java
    name 'NVarrayClass.nvaproc(oracle.sql.NUMBER[], java.sql.Array[],
    java.sql.Array)';
    show errorsI have tons of examples of array in chapter 3 and 8 of my book. The code depot is available @ http://books.elsevier.com/companions/1555583296?country=United+States
    Kuassi http://db360.blogspot.com

  • Send a array of user-defined java objects to stored procedure

    hi,
    I´d like to know if its possible send java user-defined objects to a collection. I've tried the exemple bellow but it doesn´t work:
    1) In database
    -- nested table type
    create or replace type client_table_type is table of client%rowtype;
    -- table client:
    teste
    ( id number(18,0),
    name varchar2(80),
    birthday date)
    -- stored procedure
    create or replace package client_pkg
    is
    procedure insert_clients(
    p_array_clients client_table_type
    end;
    2) In Java
    java.lang.Class.forName ("oracle.jdbc.driver.OracleDriver");
    java.sql.Connection conn = java.sql.DriverManager.getConnection("jdbc:oracle:thin .....);
    ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("client_table_type", conn);
    ARRAY a2 = new ARRAY(descriptor, conn, anArrayIn);
    PreparedStatement ps = (PreparedStatement)conn.prepareStatement("{ call client_pkg.insert_clients(?) }");
    ps.setArray(1, a2);
    ps.execute();
    Where anArrayIn is an array of Client and Client is a java user-defined class with these attributes:
    public class Client{
    public long id;
    public String name;
    public Date birthday;
    3) when I´ve tried to run the java code its returned the error in the ArrayDescriptor line:
    Exception in thread "main" java.sql.SQLException: .....:
    Unable to resolve type: "SISSERV.CLIENT_TABLE_TYPE"
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.sql.ArrayDescriptor.initPickler(ArrayDescriptor.java:1976)
    at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java:199)
    at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:118)
    at teste_array_oracle.Carga.callPLSQL(Carga.java:60)
    at teste_array_oracle.Carga.<init>(Carga.java:41)
    at teste_array_oracle.Carga.main(Carga.java:32)
    erro de execuþÒo
    Tks for any help!

    A brief answer to this from my side (not knowing Java that wel), but hopefully suffices to put you on the right track.
    <p>
    A SQL user defined type is basically a class (it can contain properties and methods). It has only superficial resemblence to a traditional record struct. So you cannot use one. Even if you could (assuming you code a PL/SQL "traditional" record struct), there are issues around how char and numeric data are represented binary inside Oracle and issues around byte/word alignment.
    <p>
    So bottom line - what you're doing will not work (as the errors show).
    <p>
    Okay, so what then? Well, the OCI (Oracle Call Interface) supports all Oracle data types, including these user types (also called Advance Data Types in Oracle-speak). You therefore need to use the supplied API calls to deal with instantiated objects (structures) of these type.
    You're best bet is to have a look Oracle® Database Java Developer's Guide

  • Passing Arrays of User Defined Types to Oracle Stored Procedures

    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
    Andy

    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

Maybe you are looking for

  • How can I deactivate an old computer that I know longer have?

    How can I deactivate an old computer that I know longer have? I own two computers and Adobe permits two computers on a subscription. However, when I bought my third new computer and didn't deactivate my old computer, I did not notify Adobe. Now, ther

  • Error while modifying the data in Emergency Contact.

    Hi All, I have developed a new application for emergency contact by following the FPM.Its a Zcopy of standard US/family application. The application is working fine except modify details.If i am trying to modify the previous records i am getting an e

  • Menubar "Time Connected" behavior changed after recent updates

    Hi folks I have been using my AXBS (11n with USB) with an DSL connection. You can choose to display the time connected from the drop-down list from the Airport icon on the Menu bar. Before this upgrade (Utility 5.5.1 and firmware 7.5.2), the "time co

  • Unreported exception java.lang.Exception; must be caught or declared

    I've got a piece of code that's causing an error during compilation. W:\Java\Covenant\src\covenant\Login.java:174: unreported exception java.lang.Exception; must be caught or declared to be thrownThe line of code it is refering to is: new Overview().

  • How to run our own jar files on Nokia 3100

    Hi, I am new to J2me. I have written an J2me application using CLDC1.1 and MIDP 2.0 it works well on emulator but when i tried to run it on device(Nokia 3100) it displays an error "Invalid File" please answer my question as soon as possible