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

Similar Messages

  • 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

  • "user defined exception" in a stored procedure and APEX

    I would like to use user defined exception in a stored procedure or trigger in a APEX application.
    Does anybody know how to do it ? or know where can I find a good reference ?
    Thanks,

    raise_application_error(-20001, 'error message');
    Scott

  • Pass an array of a user defined class to a stored procedure in java

    Hi All,
    I am trying to pass an array of a user defined class as an input parameter to a stored procedure. So far i have done the following:
    Step 1: created an object type.
    CREATE TYPE department_type AS OBJECT (
    DNO NUMBER (10),
    NAME VARCHAR2 (50),
    LOCATION VARCHAR2 (50)
    Step 2: created a varray of the above type.
    CREATE TYPE dept_array1 AS TABLE OF department_type;
    Step 3:Created a package to insert the records.
    CREATE OR REPLACE PACKAGE objecttype
    AS
    PROCEDURE insert_object (d dept_array);
    END objecttype;
    CREATE OR REPLACE PACKAGE BODY objecttype
    AS
    PROCEDURE insert_object (d dept_array)
    AS
    BEGIN
    FOR i IN d.FIRST .. d.LAST
    LOOP
    INSERT INTO department
    VALUES (d (i).dno,d (i).name,d (i).location);
    END LOOP;
    END insert_object;
    END objecttype;
    Step 4:Created a java class to map the columns of the object type.
    public class Department
    private double DNO;
    private String Name;
    private String Loation;
    public void setDNO(double DNO)
    this.DNO = DNO;
    public double getDNO()
    return DNO;
    public void setName(String Name)
    this.Name = Name;
    public String getName()
    return Name;
    public void setLoation(String Loation)
    this.Loation = Loation;
    public String getLoation()
    return Loation;
    Step 5: created a method to call the stored procedure.
    public static void main(String arg[]){
    try{
    Department d1 = new Department();
    d1.setDNO(1); d1.setName("Accounts"); d1.setLoation("LHR");
    Department d2 = new Department();
    d2.setDNO(2); d2.setName("HR"); d2.setLoation("ISB");
    Department[] deptArray = {d1,d2};
    OracleCallableStatement callStatement = null;
    DBConnection dbConnection= DBConnection.getInstance();
    Connection cn = dbConnection.getDBConnection(false); //using a framework to get connections
    ArrayDescriptor arrayDept = ArrayDescriptor.createDescriptor("DEPT_ARRAY", cn);
    ARRAY deptArrayObject = new ARRAY(arrayDept, cn, deptArray); //I get an SQLException here
    callStatement = (OracleCallableStatement)cn.prepareCall("{call objecttype.insert_object(?)}");
    ((OracleCallableStatement)callStatement).setArray(1, deptArrayObject);
    callStatement.executeUpdate();
    cn.commit();
    catch(Exception e){ 
    System.out.println(e.toString());
    I get the following exception:
    java.sql.SQLException: Fail to convert to internal representation
    My question is can I pass an array to a stored procedure like this and if so please help me reslove the exception.
    Thank you in advance.

    OK I am back again and seems like talking to myself. Anyways i had a talk with one of the java developers in my team and he said that making an array of structs is not much use to them as they already have a java bean/VO class defined and they want to send an array of its objects to the database not structs so I made the following changes to their java class. (Again hoping some one will find this useful).
    Setp1: I implemented the SQLData interface on the department VO class.
    import java.sql.SQLData;
    import java.sql.SQLOutput;
    import java.sql.SQLInput;
    import java.sql.SQLException;
    public class Department implements SQLData
    private double DNO;
    private String Name;
    private String Location;
    public void setDNO(double DNO)
    this.DNO = DNO;
    public double getDNO()
    return DNO;
    public void setName(String Name)
    this.Name = Name;
    public String getName()
    return Name;
    public void setLocation(String Location)
    this.Location = Location;
    public String getLoation()
    return Location;
    public void readSQL(SQLInput stream, String typeName)throws SQLException
    public void writeSQL(SQLOutput stream)throws SQLException
    stream.writeDouble(this.DNO);
    stream.writeString(this.Name);
    stream.writeString(this.Location);
    public String getSQLTypeName() throws SQLException
    return "DOCCOMPLY.DEPARTMENT_TYPE";
    Step 2: I made the following changes to the main method.
    public static void main(String arg[]){
    try{
    Department d1 = new Department();
    d1.setDNO(1);
    d1.setName("CPM");
    d1.setLocation("LHR");
    Department d2 = new Department();
    d2.setDNO(2);
    d2.setName("Admin");
    d2.setLocation("ISB");
    Department[] deptArray = {d1,d2};
    OracleCallableStatement callStatement = null;
    DBConnection dbConnection= DBConnection.getInstance();
    Connection cn = dbConnection.getDBConnection(false);
    ArrayDescriptor arrayDept = ArrayDescriptor.createDescriptor("DEPT_ARRAY", cn);
    ARRAY deptArrayObject = new ARRAY(arrayDept, cn, deptArray);
    callStatement = (OracleCallableStatement)cn.prepareCall("{call objecttype.insert_array_object(?)}");
    ((OracleCallableStatement)callStatement).setArray(1, deptArrayObject);
    callStatement.executeUpdate();
    cn.commit();
    catch(Exception e){
    System.out.println(e.toString());
    and it started working no more SQLException. (The changes to the department class were done manfully but they tell me JPublisher would have been better).
    Regards,
    Shiraz

  • How to pass a user defined table type to stored procedure?

    Hi,
    I am trying to call a stored procedure from Java. The store procedure has three IN parameter, 2 IN/OUT params and 3 OUT parameters. The two IN/OUT parameters are user defined objects. Can anyone tell me how to set these IN/OUT parameters in Java.
    Thanks

    It is database/driver specific so you need to use the specific functionality of the driver (not jdbc) to access it.

  • User defined class objects for a ADF component (button,inputfield)

    How do I define a user defined class object for ADF objects?
    My requirement is that when I do a modification to the class object, it should get reflectected to all the instances on my page.
    E.g:- I'm having class object clsInputField, and all my input fields in my pages are based on this object. So when I change clsInputField it should get reflected to all my controls based on this class object.
    Please help!!!

    Hi Timo,
    In our client server environment, we have a custom control for managing the zip code (used a Custom InputText field which extends the actual TextField) . All zip code specific validations are written in this custom class. In our application many of the pages uses this Custom component. So if any of the zipcode specific behaviour changes, we could implement this by only changing the Custom InputText field class.
    We need to implement this behaviour in our ADF applications. Please advise.
    Thanks,
    Vishnu

  • User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Load_Results_f

    Hi Expert,
    While running the Order Import i am getting the error please help us :
    Order Import Concurrent Program
    Concurrent Program Parameters
    Validate Only: N
    Order Source:
    Order Ref:
    Sold To Org Id:
    Sold To Org:
    Change Sequence:
    Performance Parameter: Y
    Trim Blanks: N
    Operation:
    Number of Instances: 0
    Debug Level: 0
    Request Id: 4471
    Org Id: 2453
    Failed to perform Action Request BOOK_ORDER
    Failed to perform Action Request BOOK_ORDER
    No. of orders found: 1
    No. of orders imported: 0
    No. of orders failed: 1
    Source/Order/Seq/Line Message
    10/1046001534//2 ATP Process resulted in no data
    10/1046001534//2 User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Load_Results_from_tbl
    10/1046001534//2 User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Load_Results_from_rec
    End of Order Import Concurrent Program
    Regards,
    Suraj

    And also check
    Order Import error : User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Action_Undemand,User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Action_Reschedule [ID 737031.1]

  • Problems with User Defines Mapping Objects - Dynamic Configuration

    We have a mapping object that takes data passed in from R3 and does an HTTP Post to another system using a URL and file name that is passed from the header record. We had a consultant set this up for us last year and in creating the new one we just pretty much copied what he did. The problem is, it is not working for us. We have the url and file name, we pass it to the user defined code that is supposed to pass it to the url and file name in the configuration. The java code looks like this:
    public String getPcurlOut(String pcurl,Container container){
    String ourSourceFileName = "START";
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    if (conf != null) {
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    conf.put(key, pcurl + ".xml");
    ourSourceFileName = conf.get(key);
    } else {
    ourSourceFileName = "conf == null";
    Basically we want to pass a url and file name to our communication channel based on values that come from our file in R3
    It is almost exactly like the one that works. Can anyone help with this?
    Thanks
    Mike
    Message was edited by:
            Michael Curtis

    Hi Michael
    <i>Basically we want to pass a url and file name to our communication channel based on values that come <b>from our file in R3</b></i>
    --> This means you have file as a sender adapter.
    Check adapter specific message properties in sender adapter.
    Please refer this blog , it is really worth.
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Also
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory")
    Try writing this as
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","<b>FileName</b>")
    Regards

  • User defined java function-compilation error! Activation cancelled

    Hi all!
    I have written an User defined Function in java for converting XML to PDF which is available at this blog:
    /people/divya.vidyanandanprabhu/blog/2005/06/28/converting-xml-to-pdf-using-xi
    I added both dom4j-1.6.1.jar and itext-1.4.1.jar files in (XIserver machine)D:/usr/sap/....server0/bin.
    When i try to activate in IR, i got the following error.
    Activation of the change list canceled Check result for Message Mapping test | http://httpadp.com/send:  Starting compilation  Source code has syntax error:  D:/usr/sap/QN7/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map7bf962e0f21411daae8a00111120e6db/source/com/sap/xi/tf/_test_.java:3: package com.xml2pdf does not exist import com.sap.aii.mappingtool.tf3.;import com.sap.aii.mappingtool.tf3.rt.;import java.util.;import java.io.; import java.lang.reflect.*;import com.xml2pdf.XmlToPdf; ^ D:/usr/sap/QN7/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map7bf962e0f21411daae8a00111120e6db/source/com/sap/xi/tf/_test_.java:51: cannot resolve symbol symbol : class XmlToPdf location: class com.sap.xi.tf._test_ XmlToPdf x = new XmlToPdf("D:
    qf
    source
    Input.xml", "D:
    qf
    target
    Output.pdf"); ^ D:/usr/sap/QN7/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map7bf962e0f21411daae8a00111120e6db/source/com/sap/xi/tf/_test_.java:51: cannot resolve symbol symbol : class XmlToPdf location: class com.sap.xi.tf._test_ XmlToPdf x = new XmlToPdf("D:
    qf
    source
    Input.xml", "D:
    qf
    target
    Output.pdf");

    Hi
    My java program is:
    import com.xml2pdf.XmlToPdf;
    public String testing(String a,String b,String c,Container container){
    XmlToPdf  x = new XmlToPdf("D:
    qf
    source
    Input.xml", "D:
    qf
    target
    Output.pdf");
      x.Convet();
      return "";
    Can you please figureout any errors in my prg.
    I have imported the 2(itext-1.4.1 and dom4j-1.6.1) jars into Imported Archives in my scenario in IR.
    I placed these jars in D:/usr/sap/..../server0/bin
    also. I followed the blog thoroughly and carefully.
    Thanks a lot for your suggestion.

  • Error in Loading User Defined Java Bean

    Hi Everyone,
    I am new member in this forum....and wants to explore java.
    i was creating user defined beans with userdefined Listener.
    but while loding the jar file..it gives an error that the it could not load the jar file and java.lang error in the Listener interface.
    Can anyone please help?
    Thanks a lot.

    The following page can help:
    http://java.sun.com/products/javabeans/faq/faq.help.html

  • User defined table/object with system form

    Hi,
    I added an extra tab on the invoice form. But I want to save the info in another user defined object.
    The new fields are coupled on the new added dbdatasrource. But it seems like the new added datasource is as much restricted than other dbdatasources on a system form (even if I have added them).
    I see no way to let this thing work though the datasources or registered object (because a registered object is not accessible with the DI API)
    Does anyone has a suggestion to program this?
    greetz
    Eddy

    Hi Filipe,
    I created a usertable of the document type and I created an UDO for it. And I added the fields on an extra tab on the invoice document. Therefore I have to add an extra dbdatasource to the invoice document and I binded the fields to the new added datasource.
    When I started to work with the fields and the dbdatasource I noticed that I couldn't use functions like InsertRecord and setvalue, because it is restricted. And I  didn't expect this because I added the datasource myself.
    Greetz
    Eddy

  • How to read a user defined java method inside a javascript

    I have a scenario where I have a form with 2 fields and a submit button. On clicking submit button, I call a javascript which needs to call a user-defined method.
    Please provide solution to do this and also please provide any useful links that i can go follow.
    Thanks

    Java != javascript.
    You can not call java directly from javascript.
    The lifecycle:
    Request received
    Java/JSP runs produces an HTML page
    Java stops running
    Javascript runs on page when page is loaded.
    The only way to call java code again is to submit a request and get the result back in a response. Traditionally the response is a new JSP page to replace the old one.
    Using AJAX the response can be just information that you then alter the current page with.
    The first example given by skp71 will probably NOT be what you are after. The java code is executed when you load the page, NOT when you push the button which is most probably what you are after.
    AJAX is a solution, as is loading a new page.
    Cheers,
    evnafets

  • 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

  • Passing an array as parameter from java (java controls) to stored procedure

    Hi,
    I'm using java controls (BEA Weblogic Workshop 8.1) to call a stored procedure and send an array as a parameter to the stored procedure from java. The following code below throws an exception "Fail to convert to internal representation".
    Java code
    import com.bea.control.DatabaseControl.SQLParameter;
    // Here i create the java array
    int[] javaArray={12,13,14};
    //The code below is used to create the oracle sql array for the procedure
    SQLParameter[] params = new SQLParameter[1];
    Object obj0=javaArray;
    params[0] = new SQLParameter(obj0, oracle.jdbc.OracleTypes.ARRAY, SQLParameter.IN);
    // the code below calls the testFunc method in OJDBCtrl.jcx file
    String succ= dbControl.testFunc(params);
    OJDBCtrl.jcx
    * @jc:sql statement="call CMNT_TST_PROC(?))"
    String testFunc(SQLParameter[] param);
    The stored procedure used:
    TYPE SL_tab IS TABLE OF number INDEX BY PLS_INTEGER;
    Procedure cmnt_tst_proc (cmnt_tst sl_tab);
    Procedure cmnt_tst_proc (cmnt_tst sl_tab) is
    BEGIN
    dbms_output.put_line('Hello');
    END;
    I am getting the following exception
    Failure=java.sql.SQLException: Fail to convert to internal representation: [I@438af4 [ServiceException]>
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
    at oracle.sql.ARRAY.toARRAY(ARRAY.java:210)
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7768)
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7449)
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7837)
    at oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4587)
    at weblogic.jdbc.wrapper.PreparedStatement.setObject(PreparedStatement.java:244)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl._setParameter(DatabaseControlImpl.jcs:1886)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl.getStatement_v2(DatabaseControlImpl.jcs:1732)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl.invoke(DatabaseControlImpl.jcs:2591)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:249)
    at com.bea.wlw.runtime.jcs.container.JcsContainer.invoke(JcsContainer.java:85)
    at com.bea.wlw.runtime.core.bean.BaseContainerBean.invokeBase(BaseContainerBean.java:224)
    at com.bea.wlw.runtime.core.bean.SLSBContainerBean.invoke(SLSBContainerBean.java:109)
    at com.bea.wlwgen.StatelessContainer_ly05hg_ELOImpl.invoke(StatelessContainer_ly05hg_ELOImpl.java:153)
    Can you please let me know, what i'm doing wrong and how i can pass an array to a procedure/function using java controls.
    Any help will be highly appreciated.
    Edited by: user12671762 on Feb 24, 2010 5:03 AM
    Edited by: user9211663 on Feb 24, 2010 9:04 PM

    Thanks Michael.
    Here's the final code that i used, this might be helpful for those who face this problem
    Java Code
    // Following code gets the connection object
    InitialContext ctx = new InitialContext();
    dataSource = (DataSource)ctx.lookup("<DataSourceName>");
    conn=dataSource.getConnection();
    // Following code is used to create the array type from java
    String query="CREATE OR REPLACE TYPE STR_ARRAY AS VARRAY(3) OF NUMBER";
    dbControl.runTypeQuery(query);
    // Following code is used to obtain the oracle sql array as SQLParameter
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor("<schemaName>.STR_ARRAY", conn);
    Object[] elements = new Object[3];
    elements[0] = new Integer(12);
    elements[1] = new Integer(13);
    elements[2] = new Integer(14);
    oracle.sql.ARRAY newArray = new oracle.sql.ARRAY( desc, conn, elements);
    SQLParameter[] params = new SQLParameter[1];
    params[0] = new SQLParameter(newArray, oracle.jdbc.OracleTypes.ARRAY, SQLParameter.IN);
    String succ= dbControl.testFunc(params);

  • User defined error handling in PLSQL procedure of portal form

    I need some help of building a user defined exception handling in PLSQL.
    I build a portal form based on a PLSQL procedure.
    In this procedure there are several SQL statements with exception handling.
    In case of exception I want to display my on error message and than raise the procedure, so that the user can read the message and than go back to form.
    I try this by calling a raise statement generating some HTML output over htp.p() but than the output look's like
    SQL:
    begin
    "ACHEMA2003"."P_LOGIN" ( P_STAMM_SEQ => 33491, P_ADRESSNR => 2009721, P_PASSWORD => '3333', P_PROJEKT_ID => 'ACHEMA2003', P_MESSENR => '00023', P_SPKZ => 'D');
    end;
    ORA-20000:
    Login ACHEMA 2003
    Ung|ltiges Passwort !!!
    Back to form
    I want to supress the standard Oracle messages.
    Now I read about the packages wwerr_api_error and wwerr_api_error_ui to make this, but it seems to be a little difficult.
    Is there anybody who have a solution for this problem, perhaps some example PLSQL code for this.
    Thanks Erwin.

    Jacob,
    Try following:
    declare
    v_sender VARCHAR2(1000);
    v_sender_id NUMBER;
    begin
    v_sender := p_session.get_value_as_VARCHAR2(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_SENDER');
    v_sender_id := p_session.get_value_as_NUMBER(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_SENDER_ID');
    insert into hd (number, text) values (hd_seq.nextval,
    'step 3 v_sender = ' || v_sender ||
    ' v_sender_id = ' || v_sender_id);
    if v_sender_id >= 100 then
    p_session.set_value(
    p_block_name => "_block",
    p_attribute_name => '_STATUS',
    p_value => 'Sender ID must be less than 100!');
    -- return to your form with status message set
    -- and all fields filled with recent values
    return;
    end if;
    end;
    -- This point is reached only if validation is OK
    doInsert;
    Regards,
    Henn

Maybe you are looking for

  • [SOLVED] Xscreensaver-command -lock no longer working

    As of yesterday afternoon (probably after the upgrade to 5.13-1), I have been unable to lock my monitor using xscreensaver.  The screen fades to black, only to jump back to my desktop, and xscreensaver reporting a crash.  I honestly can't see a reaso

  • Emails for process chains

    Hi Friends, I need your valuable suggestions for a problem we are currently facing regarding emails in process chains. An explanation of the issue is as follows: The users who load data (present at different geographical locations Ex. A, B, C) use a

  • Problem to login

    Hi, How to resolve this problem, to login the database? Cannot connect to PC326VM01\SSEXPR12. ADDITIONAL INFORMATION: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Me

  • Can i use imessage on iphone 4 using mobile data

    Can i use imessage and facetiome using mobile data? in 3G. on iphone 4.

  • How do I clear apps after double-tapping the home button?

    This is in relation to iOS 7.