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);

Similar Messages

  • 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

  • Passing Nested table or Vararray  from Java to Oracle store procedure

    I have some CSV file with arround 50,000 lines. I need to pass read those lines from Java to Oracle as a collection object.
    Pro & cons of both the options.
    Need some suggestions...
    Regards,
    Lokanath

    Hi,
    why not using External tables. Then you can in Oracle work it out by just using it as a normal table with all the profits.
    Herald ten Dam
    http://htendam.wordpress.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

  • How do you send a date from java to a stored procedure

    Oracle 8.0.5
    using thin drivers
    I'm trying to pass a date to a stored procedure. Does anybody
    have an example of how to do this.
    I want to send a month-day-year 01/01/1999 to oracle to be
    inserted into the table. what should the java code look like?
    and what should the (in) line look like in oracle.
    Thanks
    Kirk
    null

    Wow. You got me there.  All of the pdfs that i have, when i tap that icon, open a drop down window with the choices of e mail or print.  I wonder if the particular pdf you are working on is somehow protected?  Try a different pdf and see if the box recats the same way.   You might also do a full shut down and just try again.  Make sure there is not an old instance of i books, or some other pdf editor sitting in the task bar, by doblue clicking the home button, and shutting down any open apps.

  • How to pass array into xslt from java

    i have a xslt in which i am passing some parameter from java there is one parameter which is a array in java which i need to pass becouse array length is not defined so that xslt will work dynakically according to the parameter.
    right now i am passing parameter but not able to send the array parameter that's why my code is not fully dynamic
    please give suggestion.
    anagh

    it is not possible to pass array by using XSLT, you can wirite all values into a String with certain delim symbol, pass this string, then use xsl.substring() to get different values.

  • How to create a stored procedure that accepts an array of args from Java?

    I am to be creating a stored procedure that accepts an array of arguments from Java. How to create this? thanks
    Sam

    Not a PL/SQL question really, but a Java one. The client call is done via ThinJDBC/OCI to PL/SQL, This call must be valid and match the parameters and data types of the PL/SQL procedure.
    E.g. Let's say I define the following array (collection) structure in Oracle:
    SQL> create or replace type TStrings as table of varchar2(4000);
    Then I use this as dynamic array input for a PL/SQL proc:
    create or replace procedure foo( string_array IN TStrings )...
    The client making the call to PL/SQL needs to ensure that it passes a proper TStrings array structure.. The Oracle Call Interface (OCI) supports this on the client side - allowing the client to construct an OCI variable that can be passed as a TStrings data type to SQL. Unsure just what JDBC supports in this regard.
    An alternative method, and a bit of a dirty hack, is to construct the array dynamically - but as this does not use bind variables, it is not a great idea.
    E.g. the client does the call as follows: begin
      foo( TStrings( 'Tom', 'Dick', 'Harry' ) );
    end;Where the TStrings constructor is created by the client by stringing together variables to create a dynamic SQL statement. A bind var call would look like this instead (and scale much better on the Oracle server side):begin
      foo( :MYSTRINGS );
    end;I'm pretty sure these concepts are covered in the Oracle Java Developer manuals...

  • Pass arrays from Java to PL/SQL procedure.

    Hi All,
    Can some body give an example, where an array of strings is passed from java to a PL/SQL procedure.
    Any help in this regard is appreciated.
    Thanks,
    Prashant

    Kiran Kumar Gunda wrote:
    I would want to use Oracle provided (Oracle Extensions) API to pass arrays to PL/SQL
    procedure from Java. I am using weblogic connection pool, but the 'createDescriptor'
    method donot allow Pooled connection. So I have taken Physical Connection by casting
    to 'WLConnection'. Now, weblogic strongly suggest NOT to use this,as pooling capabilities
    will be disabled.
    But by setting RemoveInfectedConnectionsEnabled to false, we can ask weblogic
    to return the Physical Connection to Pool. I have tested this with the attached
    code. I DON'T find any issue.Good. The only real risk to obtaining the physical connection is retaining and
    using it beyond the current thread execution. Your code looks OK. The only thing
    I'd suggest is to add to the finally block. I would put a separate try-catch-ignore
    block around every action in the finally, so if one fails, the others are still
    done.
    As long as you're writing good JDBC like that, there is no risk to telling the
    pool to trust the code, by setting RemoveInfectedConnectionsEnabled to false.
    That way you'll retain all the performance of the pools.
    Joe
    >
    I want your opinion in this, so that I will be confident in using this feature
    in our application.
    Note : Please look at the sample code that I am using. I AM NOT GOING TO USE PHYSICAL
    CONNECTIONS for normal operations. I will use Physical Connection only when I
    want to pass Arrays to Oracle.
    Thanks
    Kiran

  • Pass an array of integers from C to Java with JNI

    Hello,
    I have a C function that returns a struct me. The fields of this struct are all of type integer. I, with the fields of this structure create an array of integers in C language I would like to pass this array of integers c, in Java using JNI.
    How can I make this?

    I don't see how you compiled that.
    It certainly will not compile for me.
    jintArray position=(jintArray)(*env)->NewIntArray(env,2);That is the invocation idiom for C code.
    jint f[2];You cannot have a variable declaration in the middle of a method (block) in C code. That is only allowed in C++.
    C code and C++ code is not the same.
    The following is C++ code. Note that it does NOT include getBinaryPoint() since that method could be the source of the problem.
    jintArray position = env->NewIntArray(2);
    if(position==NULL)     return NULL;
    jint f[2];
    f[0]=3;
    f[1]=4;
    env->SetIntArrayRegion(position,0,2,f);
    return position;

  • How to get the parameter from Java Script into the Parameter crystal Report

    Hi All,
    Crystal Report is integrated with Oracle 10g. I created the base SQL query for col1, col2, col3 and col4. Java Script pass parameter value (185) to Col1.
    My question is how to create crystal report to make Col1 as parameter and how to get the parameter value 185(Col1) from Java Script. Is there any additional code I need to include in the crystal report?
    FYI.
    Java script sends the right parameter value.There is no issue in java script.
    This is an automatic scheduled process when batch runs, Java script should pass the parameter value and the crystal report should get the value and produce the output report.

    Not sure if this is an application question or if you are trying to hook into Crystal Reports parameter UI? If the later then no option other than report design. If an application then I can move this to the Java Forums.
    If you are asking how to alter the parameters I suggest you remove the Java reference and post a new question so it's not confusing the issue.
    Please clarify?

  • Passing a structure from Java to PL/SQL Procedure

    Environment: Oracle DB, Tomcat/Apache
    How do we pass a structure (Table Record Type) from Java to a PL/SQL Stored Procedure?
    We are doing JSP-->JavaClass/Bean to communicate to DB. We have an existing PL/SQL packages/Procedure to insert records into table (These procedures have record types as in/out parameters). So is there a way to call these from Java?
    Thanks in advance.
    Ramesh

    Oracle9 i JDBC Developers Guide and Reference(page 21-16):
    It is not feasible for Oracle JDBC drivers to support calling arguments or return
    values of the PL/SQL RECORD, BOOLEAN, or table with non-scalar element types.
    However, Oracle JDBC drivers support PL/SQL index-by table of scalar element
    types. For a complete description of this, see "Accessing PL/SQL Index-by Tables"
    on page 16-21.
    As a workaround to PL/SQL RECORD, BOOLEAN, or non-scalar table types, create
    wrapper procedures that handle the data as types supported by JDBC. For example,
    to wrap a stored procedure that uses PL/SQL booleans, create a stored procedure
    that takes a character or number from JDBC and passes it to the original procedure
    as BOOLEAN or, for an output parameter, accepts a BOOLEAN argument from the
    original procedure and passes it as a CHAR or NUMBER to JDBC. Similarly, to wrap a
    stored procedure that uses PL/SQL records, create a stored procedure that handles
    a record in its individual components (such as CHAR and NUMBER) or in a structured
    object type. To wrap a stored procedure that uses PL/SQL tables, break the data
    into components or perhaps use Oracle collection types.

  • How to accept date parameter from java if SP have the datatype as DATE

    Dear Gurus,
    I have written SP as below
    CREATE OR REPLACE PROCEDURE proc1
    No NUMBER,
    StartDate DATE,
    EndDate DATE
    AS
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Start Date ='||to_char(StartDate,'YYYY-MM-DD HH24:MI:SS'));
    DBMS_OUTPUT.PUT_LINE('Start Date ='||to_char(EndDate,'YYYY-MM-DD HH24:MI:SS'));
    END;
    If I want to pass date from java code to above SP. Then how to send Date to SP from Java code.
    Means if I print that date in SP then it should be print as it is what i sent from java.
    e.g. Start Date = 2008-02-01 00:00:00
    End Date = 2008-02-01 23:59:59
    Could any one help me in above issue.
    Regards
    Sanjeev Atvankar

    Yes, because there is no default date format in oracle for date value having time part.
    Suppose your agreed date format between java and pl/sql is DDMMYYYYHH24MISS.
    You create procedure as:
    CREATE OR REPLACE PROCEDURE proc1
    No NUMBER,
    StartDate VARCHAR2,
    EndDate VARCHAR2,
    AS
      v_start_date date := to_date(startdate,'DDMMYYYYHH24MISS');
      v_end_date date := to_date(enddate,'DDMMYYYYHH24MISS');
    BEGIN
    /* YOU can use local pl/sql date variables inside your plsql code*/
    DBMS_OUTPUT.PUT_LINE('Start Date ='||to_char(StartDate,'YYYY-MM-DD HH24:MI:SS'));
    DBMS_OUTPUT.PUT_LINE('Start Date ='||to_char(EndDate,'YYYY-MM-DD HH24:MI:SS'));
    END;
    /

  • Passisng array from Java into PL/SQL procedure

    Hi everybody!
    I have type created with :
    CREATE OR REPLACE TYPE my_type IS TABLE OF number;
    Next I have procedure withinin a package which has parameters:
    PROCEDURE my_proc
    (p_Result OUT NUMBER,
    p_Id table.column%TYPE,
    p_MyType my_type
    I call this procedure from Java :
    import javax.sql.*;
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.sql.ARRAY;
    import oracle.sql.ArrayDescriptor;
    public class MyClass extends QueryClient {
    private int Id;
    private int type;
    private Integer[] List;
    private int result;
    public MyClass(int Id, eType type,
    Integer[] List) throws SQLException {
    this.Id = Id;
    this.type = (type.equals(eType.TYPE_EXPORT) ? 1 : 0);
    this.List = List;
    this.execute("{call my_package.my_proc(?,?,?,?)}");
    public void body(CallableStatement stmt) throws SQLException {
    ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("MY_USER.MY_TYPE", getCon());
    ARRAY array_to_pass = new ARRAY(descriptor, getCon(), this.List);
    // register the type.
    stmt.registerOutParameter(1, OracleTypes.NUMBER); // result of procedure calling
    stmt.setInt(2, this.Id );
    stmt.setInt(3, this.type);
    stmt.setArray(4, array_to_pass);
    // execute and retrieve the result set
    stmt.execute();
    this.result = stmt.getInt(1);
    public int getResult() {
    return result;
    EVERYTHING WORKS FINE, BUT when I move type "my_type" into package header
    TYPE my_type IS TABLE OF number;
    I receive error after calling procedure
    java.sql.SQLException: invalid name pattern: MY_USER.MY_TYPE
    I dropped type my_type after moving it into package. So there is only one my_type, in the package.
    User who call procedure is owner of the package.
    So questions are:
    1. Is it possible to have my_type within package without error?
    2. Is it possible to describe my_type without having a connection to database? My aim is eliminate number of connections to database.
    Thanks all.
    Matus.

    You can't use the packaged type for this. You need to use the original collection type (i.e. via the CREATE TYPE syntax) as you have discovered yourself.
    Regards

  • Calling Stored Procedure with table type as In parameter from Java

    Hi Everyone,
    Can anyone help me with the sample code to call a stored procedure having input parameter of Table type (consisting of multiple fields) from Java. This job is currently being done by a BPEL process.
    We want to implement the same using Java.
    Any sample code will be really helpful.
    Thanks & Regards,
    Vikas

    To start using a blob you have to insert it into the database and then get it back. Sounds weird but that is how it is. Here is a very simple program to do this:
    #include<occi.h>
    #include <iostream>
    using namespace oracle::occi;
    using namespace std;
    int main()
      try
        Environment *env = Environment::createEnvironment(Environment::OBJECT);
        Connection *conn = env->createConnection("hr","hr","");
        string stmt1 = "insert into blob_tab values (:1) ";
        string stmt2 = "select col1 from blob_tab";
        Blob blob(conn);
        blob.setEmpty(conn);
        Statement *stmtObj = conn->createStatement(stmt1);
        stmtObj->setBlob(1,blob);
        stmtObj->executeUpdate();
        conn->commit();
        Blob blob1(conn);
        Statement *stmtObj2 = conn->createStatement(stmt2);
        ResultSet *rs = stmtObj2->executeQuery();
        while(rs->next())
         blob1 = rs->getBlob(1);
        string stmt3 = "begin my_proc(:1) ;end;";
        Statement *stmtObj3 =  conn->createStatement(stmt3);
        stmtObj3->setBlob(1,blob1);
        stmtObj3->executeUpdate();
      catch (SQLException e)
        cout << e.getMessage();
      /* The tables and procedure are primitive but ok for demo
        create table blob_tab(col1 blob);
        create or replace procedure my_proc(arg in blob)
        as
        begin
         -- just a putline here. you can do other more meaningful operations with the blob here
          dbms_output.put_line('hello');
       end;
    }Hope this helps.
    Thanks,
    Sumit

  • Two questions on dynamic parameter from java API point of view

    Hi,
    We have a requirement for dynamic parameters in crystal reports that need to be executed in java application. Since, crystal java framework do not support the dynamic parameter execution (please correct me if I am wrong), we plan to execute explicitly the query for getting the dynamic values of such dynamic parameters before listing the parameters in java application.
    The query for the dynamic parameter will be given in the field 'Prompt Group Text' of the parameter.
    I coudl not get hold of these details from java api. So please some one help me out.
    Environment - Crystal X1 R2 with java libraries
    1. How can we identify a parameter is a dynamic one?
    2. How to get the 'Prompt Group Text' field value?
    Any suggestions welcome.
    Thanks,
    Ratan.

    There are these two methods in the Business Objects Enterprise SDK Developer Libary:
    byte[]   getDynamicCascadePromptData()
               Returns a collection that contains dynamic cascading prompt data. 
    java.lang.String getDynamicCascadePromptGroupID()
                            Returns a dynamic cascade prompt group ID. 
    For more information on what is available through available SDK's, please refer to the following link:
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm

Maybe you are looking for

  • Installing OWB on SLES 10

    Hi! Do somebody knows if Oracle OWB 10.0.2 install and run on Suse Linux Enterprise 10? It's seems it's certified only for SLES 9 but I need to install it on SLES10. Thanks in advance!

  • Alternatives to tab?

    i am having to design a page with 3 levels of nested tabs(ugh). Are there any ui components in portal that can be used instead of tabs? I am sorry if this question is general, but hoping to just get some ideas.

  • Authority Check on DatabaseConnection for HANA

    Hi, we are setting up our configuration for HANA. We want to make a Package within HANA for each functional domain. We also want to make separate connections to HANA (as secondary database) for each functional domain (Finance, Logistics, HR, ...) in

  • Execute Package and Display Results

    Hi Everyone, Just starting to use packages. I've successfully compiled the package below. Can someone please show me how to execute it and display the results with SQL Developer? Thank You in Advance for Your Help, Lou create or replace PACKAGE pkg_S

  • Trying to figure out if I have a Gigabit Ethernet card

    I'm trying to figure out if I have a gigabit ethernet card - currently, it's operating at 10x slower but I was told that sometimes it can be switched to Gigabit in the settings. If not, what kind of card should I get? Thanks!