Manipulating java array object in an oracle procedure

hi there,
i have a java store procedure that returns an array of filenames, and i have an oracle stored procedure that will for each filename returned in the java array object, open that file do some processing and load the data into database tables, now my question is, would an oracle 9i varray object be compatible with a java array, or should i pass in a pl/sql table to store the filnames returned?
i really am stuck at this point and need help !!!!
Thanx

Wole,
Have you searched the code samples available at the Technet Web site? Could you not find a relevant one?
Have you tried searching the Ask Tom Web site?
Good Luck,
Avi.

Similar Messages

  • How to send a java array to a pl/sql procedure

    Hi,
    This is similar to a post about 6 months ago on retrieving pl/sql tables from a java application but I can't seem to figure out how to use what I learned there to solve this.
    In a java application I have a Long[] array, and in the database I have a pl/sql procedure which takes a numeric in parameter. I currently loop through the array in my java application and call the procedure multiple times. What I'd prefer to do is to be able to pass the entire array to a new procedure which performs the looping internally.
    John
    null

    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.

  • Sending an array of values to Oracle procedure to use in WHERE IN clause

    I have a stored procedure in Oracle as shown below:
    <p><h5><font color=NAVY>CREATE PROCEDURE MY_TEST_PROC(
    CUR OUT SYS_REFCURSOR,
    PARAM_THAT_WILL_BE USEDINSIDE_WHERE_IN
    AS
    BEGIN
    OPEN CUR FOR
    SELECT *
    FROM MY_TABLE
    WHERE COL1 IN (here I want to put values received from C#)
    END;</font></h5></p>
    On the ASP.NET application side I have a select element with several options. I want to use these list items in my WHERE clause. I know that I can have a VARCHAR2 input parameter in my stored proc, make a comma separated string from the list items, send it to the procedure. There are two concerns with going this way:
    1.I make my website vulnerable to SQL injections
    2.In my stored proc I have to use EXECUTE ('SELECT ...') pattern which I would like to avoid.
    How can I send these list items to the stored procedure and use them inside the WHERE IN clause? I'm using ODP.NET and have heard of UDT but don't know how to use it.

    Assuming a connection variable called conn and Java String array called myStringArray, here's the gist of it:
    ArrayDescriptor descriptor1 = ArrayDescriptor.createDescriptor("STRING_ARRAY", conn);
    ARRAY array1 = new ARRAY(descriptor1, conn, myStringArray);
    OracleCallableStatement cs = (OracleCallableStatement) conn.prepareCall(sql);
    cs.setARRAY(1, array1);

  • Passing ARRAY object to stored procedure problem

    I've created a stored procedure that accepts as a parameter a
    database type
    that I have defined as a VARRAY. (create type XXX)
    When I attempt to pass an ARRAY object to this stored procedure
    through JDBC
    (Thin-client driver) I recieve the Oracle internal error ORA-
    00600 and the
    first "parameter" is [12760].
    Has anyone else attempted the same sort of thing w/ success?
    I am including the Java source code to help the investigation
    private void chad(int[] railcarIds) throws NonFatalDBException,
    FatalDBException {
    CallableStatement theStatement = null;
    try {
    theStatement = this.getDatabaseConnection().prepareCall("{call
    RomsRepairPackage.chad(?)} ");
    // create an ARRAY object to send to the procedure
    ArrayDescriptor ad =
    ArrayDescriptor.createDescriptor("RAILCARIDVARRAYTYPE",
    this.getDatabaseConnection());
    ARRAY theArray = new ARRAY(ad, this.getDatabaseConnection(),
    railcarIds);
    // set the input parameter which is the array of railcar ids
    ((OracleCallableStatement)theStatement).setARRAY(1, theArray);
    theStatement.execute();
    theStatement.close();
    } catch (SQLException sqle) {
    System.out.println("ouch");
    Thank you for any help,
    Chad Sheley
    Senior Consultant
    Cap Gemini
    Des Moines, IA
    null

    Hi
    Can u plzz help me as to how did u write the procedure to take arrays as input.I also have to write aprocedure that takes arrays and returns arrays.Plzz can u give me a working sample as I have not found any help anywhere
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Chad Sheley ([email protected]):
    I've created a stored procedure that accepts as a parameter a
    database type
    that I have defined as a VARRAY. (create type XXX)
    When I attempt to pass an ARRAY object to this stored procedure
    through JDBC
    (Thin-client driver) I recieve the Oracle internal error ORA-
    00600 and the
    first "parameter" is [12760].
    Has anyone else attempted the same sort of thing w/ success?
    I am including the Java source code to help the investigation
    private void chad(int[] railcarIds) throws NonFatalDBException,
    FatalDBException {
    CallableStatement theStatement = null;
    try {
    theStatement = this.getDatabaseConnection().prepareCall("{call
    RomsRepairPackage.chad(?)} ");
    // create an ARRAY object to send to the procedure
    ArrayDescriptor ad =
    ArrayDescriptor.createDescriptor("RAILCARIDVARRAYTYPE",
    this.getDatabaseConnection());
    ARRAY theArray = new ARRAY(ad, this.getDatabaseConnection(),
    railcarIds);
    // set the input parameter which is the array of railcar ids
    ((OracleCallableStatement)theStatement).setARRAY(1, theArray);
    theStatement.execute();
    theStatement.close();
    } catch (SQLException sqle) {
    System.out.println("ouch");
    Thank you for any help,
    Chad Sheley
    Senior Consultant
    Cap Gemini
    Des Moines, IA<HR></BLOCKQUOTE>
    null

  • How to pass a array of object to oracle procedure using callable

    Hi,
    I am calling a oracle stored procedure using callable statement which has IN and OUT parameter of same type.
    IN and OUT are array of objects. (ie) IN parameter as Array of Objects and OUT parameter as Array of Objects
    here are the steps i have done as advised from oracle forum. correct me if i am in wrong direction
    ORACLE types and Stored Procedure
    CREATE OR REPLACE
    TYPE APPS.DEPARTMENT_TYPE AS OBJECT (
    DNO NUMBER (10),
    NAME VARCHAR2 (50),
    LOCATION VARCHAR2 (50)
    CREATE OR REPLACE
    TYPE APPS.DEPT_ARRAY AS TABLE OF department_type;
    CREATE OR REPLACE package body APPS.insert_object
    IS
    PROCEDURE insert_object_prc (d IN dept_array, d2 OUT dept_array)
    IS
    BEGIN
    d2 := dept_array ();
    FOR j IN 1 .. d.COUNT
    LOOP
    d2.EXTEND;
    d2 (j) := department_type (d (j).dno, d (j).name, d(j).location);
    END LOOP;
    END insert_object_prc;
    END insert_object;
    JAVA CODE
    Value Object
    package com.custom.vo;
    public class Dep {
    public int empNo;
    public String depName;
    public String location;
    public int getEmpNo() {
    return empNo;
    public void setEmpNo(int empNo) {
    this.empNo = empNo;
    public String getDepName() {
    return depName;
    public void setDepName(String depName) {
    this.depName = depName;
    public String getLocation() {
    return location;
    public void setLocation(String location) {
    this.location = location;
    to call stored procedure
    package com.custom.callable;
    import com.custom.vo.Dep;
    import oracle.jdbc.OracleCallableStatement;
    import oracle.jdbc.OracleConnection;
    import oracle.jdbc.OracleTypes;
    import oracle.jdbc.pool.OracleDataSource;
    import oracle.sql.ARRAY;
    import oracle.sql.ArrayDescriptor;
    import oracle.sql.Datum;
    import oracle.sql.STRUCT;
    import oracle.sql.StructDescriptor;
    public class CallableArrayTryOut {
    private static OracleDataSource odcDataSource = null;
    public static void main(String[] args) {
    OracleCallableStatement callStatement = null;
    OracleConnection connection = null;
    try {
    odcDataSource = new OracleDataSource();
    odcDataSource
    .setURL("......");
    odcDataSource.setUser("....");
    odcDataSource.setPassword("....");
    connection = (OracleConnection) odcDataSource.getConnection();
    } catch (Exception e) {
    System.out.println("DB connection Exception");
    e.printStackTrace();
    Dep[] dep = new Dep[2];
    dep[0] = new Dep();
    dep[0].setEmpNo(100);
    dep[0].setDepName("aaa");
    dep[0].setLocation("xxx");
    dep[1] = new Dep();
    dep[1].setEmpNo(200);
    dep[1].setDepName("bbb");
    dep[1].setLocation("yyy");
    try {
    StructDescriptor structDescriptor = new StructDescriptor(
    "APPS.DEPARTMENT_TYPE", connection);
    STRUCT priceStruct = new STRUCT(structDescriptor, connection, dep);
    STRUCT[] priceArray = { priceStruct };
    ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor(
    "APPS.DEPT_ARRAY", connection);
    ARRAY array = new ARRAY(arrayDescriptor, connection, priceArray);
    callStatement = (OracleCallableStatement) connection
    .prepareCall("{call insert_object.insert_object_prc(?,?)}");
    ((OracleCallableStatement) callStatement).setArray(1, array);
    callStatement.registerOutParameter(2, OracleTypes.ARRAY,
    "APPS.DEPT_ARRAY");
    callStatement.execute();
    ARRAY outArray = callStatement.getARRAY(2);
    Datum[] datum = outArray.getOracleArray();
    for (int i = 0; i < datum.length; i++) {
    oracle.sql.STRUCT os = (oracle.sql.STRUCT) datum[0];
    Object[] a = os.getAttributes();
    for (int j = 0; j < a.length; j++) {
    System.out.print("Java Data Type :"
    + a[j].getClass().getName() + "Value :" + a[j]
    + "\n");
    connection.commit();
    callStatement.close();
    } catch (Exception e) {
    System.out.println("Mapping Error");
    e.printStackTrace();
    THE ERROR
    Mapping Errorjava.sql.SQLException: Inconsistent java and sql object types
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1130)
    at oracle.sql.StructDescriptor.toOracleArray(StructDescriptor.java:823)
    at oracle.sql.StructDescriptor.toArray(StructDescriptor.java:1735)
    at oracle.sql.STRUCT.<init>(STRUCT.java:136)
    at com.custom.callable.CallableArrayTryOut.main(CallableArrayTryOut.java:48)

    You posted this question in the wrong forum section. There is one dedicated to Java that was more appropriate.
    Anyway here is a link that describes what you should do.
    http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/oraarr.htm#i1049179
    Bye Alessandro

  • Trying to pass Oracle array/object type to Java

    I have a Java class with two inner classes that are loaded into Oracle:
    public class PDFJ
        public static class TextObject
            public String font_name;
            public int font_size;
            public String font_style;
            public String text_string;
        public static class ColumnObject
            public int left_pos;
            public int right_pos;
            public int top_pos;
            public int bottom_pos;
            public int leading;
            public TextObject[] column_texts;
    }I have object types in Oracle as such that bind to the Java classes:
    CREATE OR REPLACE TYPE "PROGRAMMER"."PDFJ_TEXT" AS OBJECT
    EXTERNAL NAME 'PDFJ$TextObject'
    LANGUAGE JAVA
    USING SQLData(
      "FONT_NAME" VARCHAR2(25) EXTERNAL NAME 'font_name',
      "FONT_SIZE" NUMBER EXTERNAL NAME 'font_size',
      "FONT_STYLE" VARCHAR2(1) EXTERNAL NAME 'font_style',
      "TEXT_STRING" VARCHAR2(4000) EXTERNAL NAME 'text_string'
    CREATE OR REPLACE TYPE "PROGRAMMER"."PDFJ_TEXT_ARRAY" AS
      TABLE OF "PROGRAMMER"."PDFJ_TEXT";
    CREATE OR REPLACE TYPE "PROGRAMMER"."PDFJ_COLUMN" AS OBJECT
    EXTERNAL NAME 'PDFJ$ColumnObject'
    LANGUAGE JAVA
    USING SQLData(
      "LEFT_POS" NUMBER EXTERNAL NAME 'left_pos',
      "RIGHT_POS" NUMBER EXTERNAL NAME 'right_pos',
      "TOP_POS" NUMBER EXTERNAL NAME 'top_pos',
      "BOTTOM_POS" NUMBER EXTERNAL NAME 'bottom_pos',
      "LEADING" NUMBER EXTERNAL NAME 'leading',
      "COLUMN_TEXTS" "PROGRAMMER"."PDFJ_TEXT_ARRAY" EXTERNAL NAME 'column_texts'
    CREATE OR REPLACE TYPE "PROGRAMMER"."PDFJ_COLUMN_ARRAY" AS
        TABLE OF "PROGRAMMER"."PDFJ_COLUMN";
    /I successfully (as far as I know) build a PDFJ_COLUMN_ARRAY object in a PL/SQL procedure. The PDFJ_COLUMN_ARRAY contains PDFJ_COLUMN objects; each of those objects contains a PDFJ_TEXT_ARRAY of PDFJ_TEXT objects (Example: pdf_column_array(i).pdf_text_array(i).text_string := 'something';). In this procedure, I pass this PDFJ_COLUMN_ARRAY as a parameter to a Java function. I assume the Java function parameter is supposed to be a oracle.sql.ARRAY object.
    I cannot figure out how to decompose this generic ARRAY object into a ColumnObject[] array. I also tried Googling and searching the forums, but I can't figure out matching search criteria. I was wondering if anyone here knows anything about passing user-defined Oracle type objects to a Java function and retrieving the user-defined Java class equivalents that they are supposedly mapped to--especially a user-defined array type of user-defined object types containing another user-defined array type of user-defined object types.

    Ok. I will try asking on the JDBC forum. So, don't
    flame me for cross-posting. :PWe won't, if over there you just post basically a
    link to this one.
    sigh Guess what, he did it the flame-deserving way. It's crossposted at:
    http://forum.java.sun.com/thread.jspa?threadID=602805
    <flame level="mild">Never ceases to amaze me how people don't think that posting a duplicate rather than a simple link isn't wasteful, as people could end up answering in both of them, not seeing each other's answers</flame>

  • Conversion of java Array to oracle SQL Array while calling Stored Procedure

    How java Array can be converted to oracle SQL array while calling Stored procedure with callable statement.
    i.e java Array ---> Sql Array in Oracle while setting the datatypes to callable statement arguments.

    Look at:
    http://forum.java.sun.com/thread.jsp?forum=48&thread=376735&tstart=0&trange=15
    Paul

  • How to create Array type parameter of Oracle 10.2.0.1.0 in java

    I create a collection type with:
    CREATE OR REPLACE
    type TEST_User.T_ARRAY AS TABLE OF VARCHAR2(100);
    and in java code, I use following code to create a parameter of this type, and set it for a procdure
    String[] userMakeArray = new String[]{"V", "N", "A"};
    oracle.sql.ArrayDescriptor descriptor = oracle.sql.ArrayDescriptor.createDescriptor("TEST_User.T_ARRAY", cn); // cn is connection instance to database
    oracle.sql.ARRAY array = new oracle.sql.ARRAY(descriptor, cn, userMakeArray);
    ((oracle.jdbc.OracleCallableStatement)call).setArray(8, array);
    when i use this to call procedure in Oracle 10.1, it work well.
    In Oracle 10.2, it does not work well.
    For test, I can execute procedure well in sql plus, but in java client, I found that array contains three items "Null", while array is correct when conect to 10.1 enviroment.
    does anybody know what's the reason for this.
    thanks a lot.

    Hi,
    Too long to copy/paste here but i have a simpler working example of Nested Table of VARCHAR2 type against 10.2.0.x, in chapter 3 and 8 of my book:
    create or replace type NTab_Vc2 as TABLE of varchar2(30)
    create table NSTableTab (id int, numnt NTab_Num, vc2nt NTab_Vc2, datnt
    NTab_Dat)
    nested table numnt store as NSTabNum,
    nested table vc2nt store as NSTabVc2,
    nested table datnt store as NSTabDat;
    insert into NSTableTab values (1,
    NTab_Num(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
    NTab_Vc2 ('One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'),NTab_Dat('01-JAN-2003', '02-JAN-2003', '03-JAN-2003', '04-JAN-2003',
    '05-JAN-2003', '06-JAN-2003', '07-JAN-2003', '08-JAN-2003',
    '09-JAN-2003', '10-JAN-2003')
    // The following code snippet retrieves and returns a
    // NTab_Vc2 as a java.sql.Array
    OraclePreparedStatement ps = (OraclePreparedStatement)
    conn.prepareStatement ("SELECT VC2NT FROM NSTableTab
    WHERE ID = ?");
    ps.setNUMBER (1, id[0]);
    OracleResultSet rs = (OracleResultSet) ps.executeQuery();
    Array a = null;
    while (rs.next())
    a = (Array) rs.getObject(1);
    ps.close();
    return a;
    Kuassi, http://db360.blogspot.com/2006/08/oracle-database-programming-using-java_01.html

  • On making call to Oracle procedures from Java, Value becomes null on oracle

    We are using some user defined Oracle data types in my Java/J2EE application
    and some of them are Oracle collections(ex. VARRAY).
    We are making a call to Procedures/Functions from Java, there are some
    parameters of user defined data types declared in the
    procedures/functions, from java the values are properly setting to these
    user defined data type parameters and sending to Procedures.
    We are not getting any exception at Java side and Oracle side and values
    are becoming blank/null at oracle procedure side for the parameters of
    user defined data types.
    But when do the count of collection of user defined data type then it is
    properly giving the size of collection(VARRAY).
    When we are trying to read the values from the collection(VARRAY) it is
    giving blank/null value and there is no exception.
    Please let me know if you have any suggestion on this?

    user7671994 wrote:
    When we are trying to read the values from the collection(VARRAY) it is
    giving blank/null value and there is no exception.If you are talking about VARCHAR2 parameters of the objects - then you should add orai18n.jar to classpath.

  • How to pass ARRAY to Oracle Procedure

    Hi
    We are using BC4J with JSP in our project. We need to send an Array to the procedure.
    Could somebody provide some info as how this can be achieved.

    A while back, I used a SQLJ client to call a Java (also SQLJ) stored procedure and I needed to pass an array of strings to the procedure. I did something like this:
    Java Class that was loaded in DB:
    public class MyClass
    // method that the stored procedure uses
    public static void CALL_DOSTUFF(String a,
    oracle.sql.ARRAY b,
    oracle.sql.ARRAY c)
    String[] bb = (String[])b.getArray();
    String[] cc = (String[])c.getArray();
    doStuff(a,bb,cc);
    public static void doStuff(String a,
    String[] b,
    String[] c)
    // process the input
    In the database I added the type:
    create or replace type STR_ARRAY as table of varchar2(20);
    and the procedure:
    create or replace procedure CALL_DOSTUFF(a varchar2,
    b STR_ARRAY,
    c STR_ARRAY)
    as
    language java
    name 'MyClass.CALL_DOSTUFF(java.lang.String,
    oracle.sql.ARRAY,
    oracle.sql.ARRAY)';
    I then used jpub to publish a STR_ARRAY.java file. I compiled this and used it with my SQLJ client to call to the stored procedure. The STR_ARRAY constructor takes a String[], so you do something like this in the SQLJ client:
    String x = "X";
    String y = {"y1","y2"};
    String z = {"z1","z2"};
    STR_ARRAY y1 = new STR_ARRAY(y);
    STR_ARRAY z1 = new STR_ARRAY(z);
    #sql {CALL CALL_DOSTUFF(:x,:y1,:z1)};
    Hope this helps.

  • Problem in calling oracle procedure from java

    Oracle procedure with the following parameters.
    CREATE OR REPLACE PROCEDURE CREDITED_TO_STORE_INSERT (P_CUST# IN NUMBER,
    P_INV_DATE IN DATE,
    P_MEMO# IN NUMBER,
    P_SESS_ID IN VARCHAR2 ) IS
    BEGIN
    /*.........Procedure Body with select and insert statements there no OUT or return variable/value......*/
    END;
    Now i am calling this procedure with the java code in java.
    public boolean execProcedure(String storeNo, String invoiceDate, String claimNo, String sessionID) throws SQLException {
         CallableStatement cstmt = null;
         java.sql.Date invicDate = this.StringToDate(invoiceDate);
         try
         cstmt = conn.prepareCall("{call WEBUSER.CREDITED_TO_STORE_INSERT(?,?,?,?,?,?)}");
         cstmt.setInt(1, Integer.parseInt(storeNo));
         cstmt.setDate(2, invicDate);
         cstmt.setInt(3, Integer.parseInt(claimNo));
         cstmt.setString(4, sessionID);
         cstmt.execute();
         catch (Exception e)
         System.out.println (e);
         } // catch (Exception e)
         finally
         try
         cstmt.close();
         catch (Exception ex)
         } // catch (Exception ex)
         } // finally
         return true;
    But it will return the following exception.
    [STDOUT] java.sql.SQLException: Missing IN or OUT parameter at index:: 5
    i don't know why :( please help me ...

    your procedure has 4 parameters but in the prepared statement you define 6 placeholders

  • OCI 22303 exception - Pass object to type Record in oracle procedure

    Recently i had my first encounter with ODP.NET and Oracle. I'm developing a a datalayer that can access a stored procedure on an Oracle database.
    The problem i'm having is the following:
    I'm using this method to pass my parameters to the procedure: http://www.codeproject.com/KB/cs/CustomObject_Oracle.aspx
    I have also attempted this approach:
    http://developergeeks.com/article/48/3-steps-to-implement-oracle-udt-in-odpnet
    I always get the message (litteraly):
    Oracle.DataAccess.Client.OracleException: OCI-22303: type &quote;PAC$WEBSHOP_PROCS&quot;.&quot;CUSTOMER_IN_RECTYPE&quot; not found.
    It sounds weird to me, but what are the &quotes doing here in the error message I see?
    Some code i use:
    OracleParameter objParam = new OracleParameter
    OracleDbType = OracleDbType.Object,
    Direction = ParameterDirection.Input,
    ParameterName = "PAC$WEBSHOP_PROCS.P_CUSTOMER_IN",
    UdtTypeName = "PAC$WEBSHOP_PROCS.WEBSHOP_PROCS.CUSTOMER_IN_RECTYPE",
    Value = card
    The information i have about the Oracle procedure:
    CREATE OR REPLACE PACKAGE PAC$WEBSHOP_PROCS IS
    TYPE CUSTOMER_IN_RECTYPE IS RECORD
    (CUS_STO_IDENTIFIER NUMBER(2)
    ,CUS_IDENTIFIER NUMBER(6)
    ,CH_IDENTIFIER NUMBER(2)
    ,CH_CARD_VERSION NUMBER(1)
    PROCEDURE PRC$WS_VALIDATE_CARD
    (P_CUSTOMER_IN IN PAC$WEBSHOP_PROCS.CUSTOMER_IN_RECTYPE
    ,P_RETURN_CODE IN OUT NUMBER
    Any help to cover my problem would be greatly appreciated.
    Thx
    Edited by: 836497 on 14-feb-2011 4:36

    The only way to call it as is would be via an anonymous plsql block, where you create the record type inside the block. Interacting with the block via ODP would be limited to scalar values.
    Here's a PLSQL example just to demonstrate. Here, v1 and v2 are bind variables of scalar type, which you'd setup/bind via ODP instead of the SQL prompt as I did, but I thought this might keep things simpler for the example.
    The other choice would be to write a wrapper procedure that takes type OBJECT that you can call from ODP, and inside that procedure convert them to/from RECORD and call the original procedure.
    Hope it helps,
    Greg
    SQL> drop package somepack;
    Package dropped.
    SQL> create package somepack as
      2  type somerectype is record(n1 number);
      3  function somefunc (v1 somerectype) return somerectype;
      4  end;
      5  /
    Package created.
    SQL>
    SQL> create package body somepack as
      2  function somefunc (v1 somerectype) return somerectype is
      3   begin
      4    return v1;
      5   end;
      6  end;
      7  /
    Package body created.
    SQL>
    SQL>
    SQL> var v1 number;
    SQL> exec :v1 := 5;
    PL/SQL procedure successfully completed.
    SQL> var v2 number;
    SQL>
    SQL>
    SQL> declare
      2   localvar1 somepack.somerectype;
      3   localvar2 somepack.somerectype;
      4  begin
      5     localvar1.n1 := :v1;
      6     localvar2 := somepack.somefunc(localvar1);
      7     :v2 := localvar2.n1;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL>  print v2;
            V2
             5
    SQL>

  • How to pass an array in Oracle Procedure

    If I have to pass an array as an argument in Oracle Procedure/function. How to do that ??
    For example, I have to pass the names of employess and then for these employess I have to do something in Oracle Procedure.
    Thanks & Regards,
    Vinay

    Hi!
    Here is an example:
    create or replace procedure test
    is
    type v2_itt is table of varchar2(2000) index by binary_integer;
    l_v2 v2_itt;
    procedure test2( pi_v2 v2_itt ) is
    begin
    for i in 1 .. pi_v2.count loop
    dbms_output.put_line( pi_v2(i) );
    end loop;
    end;
    begin
    l_v2(1) := 'name1';
    l_v2(2) := 'name2';
    test2( l_v2 );
    end;
    Regards,
    Andrew Velitchko
    BrainBench MVP for Developer/2000
    http://www.brainbench.com

  • Java and oracle procedure

    Hi guys,
    I would like to know if it´s possible to use java code inside a Oracle procedure. If yes how can I do it ?
    Thank you,
    Felipe

    Hi,
    I guess you are talking about Java Stored Procedures :-
    http://www.oracle.com/technology/tech/java/jsp/index.html
    Can you tell us more about your business requirements ?
    Regards,
    Sandeep

  • Is Array in java are Object?

    is Array in java are Object?
    int a[]=new int[10];
    new will allocate memory. but int is a type not an Class ?
    please help me.......

    An array in Java is an object. Array elements may be primitives or references, depending on the way the array is declared.

Maybe you are looking for