How to passing array as parameter to oracle stored procedure from JPA

Hi All,
I need to call a stored proc in Oracle that accepts an array as input parameter.
Pls let me know how should i call it from my JPA. Is this even possible without using JDBC directly?
i keep getting the ff error:
wrong number or types of arguments in call to ....
my code is something like this:
String[] myArr...
Query query = em.createNativeQuery("BEGIN myStoredProc(:arr); END;");
query.setParameter("arr", myArr);
Thanks in advance.

I also fail to get this done my code till now is:
PLSQL Function:
function getHtml(pWhere VARCHAR2 DEFAULT NULL,
pColSort HTP.STRINGARRAY) return clob is
begin
errorhndl.Log(pMessage => 'called');
htp.prn('das ist der test
for i in 1 .. pColSort.count loop
htp.p('
pColSort['||i||']: '||pColSort(i));
end loop;
htp.prn('
<table> <tr> <td> max1.0 </td> <td> max2.0 </td> </tr>');
htp.prn('<tr> <td> max1.1 </td> <td> max2.1 </td> </tr> </table>');
htp.prn('test ende');
return htp.gHtpPClob;
exception
when others then
null;
end getHtml;
PLSQL TYPE: (in HTP package - self created - but could be anywhere else too)
type STRINGARRAY is table of varchar2(256) index by binary_integer;
JAVA DOA:
public class ShowReportDOAImpl implements ShowReportDOA {
     private JdbcTemplate jdbcTemplate;
     private SimpleJdbcCall procShowReport;
     public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
          this.jdbcTemplate = jdbcTemplate;
          procShowReport = new SimpleJdbcCall(this.jdbcTemplate)
          .withCatalogName("Show_Report")
          .withFunctionName("getHtml")
          .withoutProcedureColumnMetaDataAccess()
          .declareParameters(
               new SqlParameter("pWhere", Types.VARCHAR),
               new SqlParameter("pColSort", Types.ARRAY, "HTP.STRINGARRAY"),
               new SqlOutParameter("RETURN", Types.CLOB)
     public String readReport(Long id, ParameterHelper ph) {
          String[] sortCol = {"max", "michi", "stefan"};
          String pWhere = "fritz";
          MapSqlParameterSource parms = new MapSqlParameterSource();
          parms.addValue("pWhere", pWhere);
          parms.addValue("pColSort", sortCol, Types.ARRAY, "HTP.STRINGARRAY");
parms.addValue("pColSort", Arrays.asList(sortCol), Types.ARRAY, "HTP.STRINGARRAY");
Clob clob = procShowReport.executeFunction(Clob.class, parms);
String clobString = "";
try {
     System.out.println("length: "+new Long(clob.length()).intValue());
               clobString = clob.getSubString(1, new Long(clob.length()).intValue());
          } catch (SQLException e) {
               e.printStackTrace();
return clobString;
EXCEPTION IS:
org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{? = call SHOW_REPORT.GETHTML(?, ?)}]; SQL state [null]; error code [17059]; Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]; nested exception is java.sql.SQLException: Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]
     org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
     org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
     org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
     org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:969)
     org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1003)
     org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:391)
     org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:354)
     org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:154)
     at.ontec.cat.config.doa.ShowReportDOAImpl.readReport(ShowReportDOAImpl.java:47)
     at.ontec.cat.http.ShowReport.doGet(ShowReport.java:80)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
     org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
java.sql.SQLException: Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]
     oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
     oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
     oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:860)
     oracle.sql.ARRAY.toARRAY(ARRAY.java:209)
     oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7767)
     oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7448)
     oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7836)
     oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4586)
     org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
     org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
     org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:356)
     org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:216)
     org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:127)
     org.springframework.jdbc.core.CallableStatementCreatorFactory$CallableStatementCreatorImpl.createCallableStatement(CallableStatementCreatorFactory.java:212)
     org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:947)
     org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1003)
     org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:391)
     org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:354)
     org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:154)
     at.ontec.cat.config.doa.ShowReportDOAImpl.readReport(ShowReportDOAImpl.java:47)
     at.ontec.cat.http.ShowReport.doGet(ShowReport.java:80)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
     org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
Please help!!
Please help!!

Similar Messages

  • Problem in calling Oracle stored procedure from Java.

    I am trying to invoke the Oracle stored procedure from Java. The procedure does not take any parameters and does not return anything. If I call it from SQL prompt it is working perfectly. I am calling it in my program as follows.
    callable_stmt=con.prepareCall("{call pkg_name.proc_name()}");
    callable_stmt.execute();
    The problem is the control-of-flow is getting strucked in the second line I wrote. It is not giving any error also.
    Please clarify me what's wrong with my code?
    Seenu.

    And how long does the stored procedure take to run from your client machine when running it via sqlplus?

  • Invoking Oracle stored procedures from within a JDBC channel for PI 7.1

    Hi ,
    Can anybody tell me that is it possible to invoke Oracle stored Procedure from within a JDBC  sender channel for PI 7.1.
    Its working in XI3.0 and XI 7.0 for Oracle DBMS versions >= 10.2.x. But I am not sure,whether it will work for PI 7.1 also.
    Thanks & Regards,
    Saru

    HI,
    refer below link,there is no much difference in PI7.1 ,executing stored procedure is same .
    http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/7b72b2fde93673e10000000a114a6b/content.htm
    Regards,
    Raj

  • Calling Oracle stored procedure from xMII Query Templates.

    Hi All,
    We have a requirement to call a Oracle stored procedure from xMII, the SP expects some inputs and then it returns multiple rows.
    I tried different approches with no results, I remember some posts on the same topic but I could not get in search results.
    Looking for some help in this regards
    Rupesh.

    Hi Rupesh Bajaj,
    In oracle stored procedure we have to use Packages..if you used packages the u have to assign to some variable.
    To calling Stored procedure  in Query Template is CALL Testing('[Param.1]','[Param.2]',,:X)
    In above line Testing is Stored procedure name and Param.1 is parameters and X is Package.
    Thanks
    Ravilla Ramesh

  • Execute Oracle Stored Procedure from Excel

    Is it possible to execute an Oracle Stored Procedure from Microsoft Excel and return the result of the Oracle Store Procedure into the excel spreadsheet.

    Yes. You can use Oracle Objects for OLE to accomplish this. It comes with Excel examples and an online help file with many more examples.

  • Passing Multi-Value Parameter to a Stored Procedure

    Has anyone experienced passing a Parameter (MultiValue) to a Stored Procedure? I am aware that Crystal Passes the Param as an Array. How would you go about handling this within a Stored Procedure???

    Hi Daniel
    Try as below:
    1. Create a Crystal report, and add a multi-value parameter.
    2. Since the multi-value parameter is treated as an array, create a formula that uses the JOIN function. Create a formula as below:
    //Formula: @JoinFormula
    Join ({?Multi-value parameter array},";")
    ====================
    NOTE:
    In the formula above, a semi-colon (";") is the delimiter.
    ====================
    3. Within the main report, create a subreport based on the stored procedure, and include the parameter to be populated with the multi-value list.
    4. Link the Join formula in the main report to the stored procedure parameter in the subreport.
    Doing so passes a multi-value parameter to the stored procedure.
    Hope this helps!!!!
    Regards
    Sourashree

  • How to pass a presentation variable to a stored procedure?

    Hi All,
    We have a complex security model to emulate. In order to achieve that, we need to find a way for OBI to run and pass parameter to a stored procedure (SP).
    "APlus_BI_EmplName2" is the name of the stored procedure.
    This SP requires a param and can be run in toad for SQL as : - exec APlus_BI_EmplName2 @ empno
    here is one example:- exec APlus_BI_EmplName2 128807
    It will result in empno, empname (128807,Looney VALERIE).
    Also, I have made a sample report on the Dashboard.Here i'm capturing a employee number via a dropdown in a presentation variable ( "empno") which i would like to pass to the stored procedure... just a way of testing that a variable/param can be passed to SP...
    Can anybody tell how to achieve the same?
    Regards,
    Apoorv

    What session variable now?
    You asked something else:
    Hi All,
    We have a complex security model to emulate. In order to achieve that, we need to find a way for OBI to run >and pass parameter to a stored procedure (SP).
    "APlus_BI_EmplName2" is the name of the stored procedure.
    This SP requires a param and can be run in toad for SQL as : - exec APlus_BI_EmplName2 @ empno
    here is one example:- exec APlus_BI_EmplName2 128807
    It will result in empno, empname (128807,Looney VALERIE).
    Also, I have made a sample report on the Dashboard.Here i'm capturing a employee number via a dropdown in a >presentation variable ( "empno") which i would like to pass to the stored procedure... just a way of testing that a >variable/param can be passed to SP...
    Can anybody tell how to achieve the same?To understand your problem please post your init. block code and your dashboard prompt field explanation.
    Regards
    Goran
    http://108obiee.blogspot.com

  • Would like to pass multi-value parameter to a stored procedure

    Hi,
    Is it possible to pass a multi-value parameter to a stored procedure using crystal reports.
    Is there is a way to do so??/
    Thanks,
    Brian.

    Hi,
    Is it that you want to pass 2 or more parameters to a stored proc. it is possible
    go to database expert
    select your connection and click on add command their you will have to create parameters and pass to a proc
    for ref..
    {CALL `menagerie`.`sp_timer`({?delay time},{?delay time2})}
    where `menagerie`.`sp_timer` is a stored proc.
    and delay time and delay time2 are  parameters.
    but if it is like you have to pass multiple values to stored proc using single parameter as per my experience its
    not possible.

  • Execute oracle stored procedure from C# always returns null

    Hi,
    I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
    Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
    This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
    Below are the SP, and the code used from .Net to call it, if that can help.
    Oracle SP:
    CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
    v_status VARCHAR2(5) := NULL;
    BEGIN
    BEGIN
    SELECT CHECK_NO_EXISTENCE(to_char(l_number))
    INTO v_status
    FROM DUAL;
    EXCEPTION WHEN OTHERS THEN
    v_status := NULL;
    END;
    DBMS_OUTPUT.PUT_LINE(v_status);
    END CHECK_CONTRNO_EXISTENCE;
    C# Code:
    string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
    OracleConnection conn = new OracleConnection(connStr);
    OracleParameter param1 = new OracleParameter();
    param1.ParameterName = "v_status";
    param1.OracleType = OracleType.VarChar;
    param1.Size = 5;
    param1.Direction = ParameterDirection.Input;
    OracleParameter param2 = new OracleParameter();
    param2.ParameterName = "l_number";
    param2.OracleType = OracleType.Number;
    param2.Direction = ParameterDirection.Input;
    param2.Value = 006550249;
    OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
    OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddRange(oraParams);
    conn.Open();
    object result = cmd.ExecuteScalar();
    conn.Close();

    Hi,
    Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
    Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
    If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
    See if this helps.
    Cheers,
    Greg
    create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
    is
    retval varchar2(50);
    begin
    myoutvar := myinvar;
    retval := 'the return value';
    return retval;
    end;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class odpfuncparams
         public static void Main()
          OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
          con.Open();
          OracleCommand cmd = new OracleCommand("myfunc", con);
          cmd.CommandType = CommandType.StoredProcedure;
          OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
          retval.Direction = ParameterDirection.ReturnValue;
          cmd.Parameters.Add(retval);
          OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
          inval.Direction = ParameterDirection.Input; 
          inval.Value="hello world";
          cmd.Parameters.Add(inval);
          OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
          outval.Direction = ParameterDirection.Output;
          cmd.Parameters.Add(outval);
          cmd.ExecuteNonQuery();
          Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
          con.Close();
    }

  • Calling Oracle Stored Procedure from BC4J JSP App

    I am on an extremely tight deadline and am trying to get my JSP application to use an Oracle Stored Procedure. I need to take some input from the user and send these values as parameters. Has anyone worked with Stored Procedures in JDev3.1? Please reply with some sample code if possible.
    Thanks.

    Hi,
    Someone posted a similar request the other day. Here is my response to them:
    Basically, you need to create a custom method from your JSP's ViewObject, which calls the stored procedure. You can then call the ViewObject's custom method from the JSP client.
    Here is how I have done it:
    1. Choose the ViewObject that your JSP is based on and choose 'Edit' from the context menu.
    2. On the Java tab of the ViewObject wizard, choose Generate Java File checkbox for the View Object Class and click the Finish button. A file is created under the ViewObject node in the Navigator named 'viewobjectImpl.java'.
    3. Open the viewobjectImpl.java file in the code editor and create a method to call your stored procedure (see sample code below).
    4. Compile the VOImpl.java file.
    5. Choose the view object again, and choose Edit again from the context menu.
    6. On the Client Methods tab, you should now see your method appear in the Available field. Select it and shuttle it to the Selected field.
    7. Click Finish to leave the VO wizard, and rebuild your Business Components project.
    8. In your JSP, call the custom method (see sample code below).
    sample code for custom method calling a stored procedure from VOImpl.java file:
    public int getTotalHits(String mon, String year) {
    CallableStatement stmt = null;
    int total;
    // the call to the PL/SQL stored proc
    String totalhits = "{? = call walkthru.total_hits(?,?)}";
    // use the AM conxn 2 call storedproc
    stmt = getDBTransaction().createCallableStatement(totalhits, 1);
    try
    // Bind the Statement Parameters and //Execute this Statement
    stmt.registerOutParameter(1,Types.INTEGER);
    stmt.setString(2,mon); stmt.setString(3,year);
    stmt.execute();
    total = stmt.getInt(1);
    catch (Exception ex)
    throw new oracle.jbo.JboException(ex);
    finally
    try
    stmt.close();
    catch (Exception nex)
    return total;
    sample render code for calling custom method from JSP custom bean:
    public void render() {
    int totalhits;
    try
    Row[] rows;
    // Retrieve all records by default, the qView variable is defined in the base class
    qView.setRangeSize(-1);
    qView.first();
    rows = qView.getAllRowsInRange();
    // instantiate a view object for our exported method
    // and call the stored procedure to get the total
    ViewObject vo = qView.getViewObject();
    wtQueryView theView = (wtQueryView) vo;
    totalhits = theView.getTotalHits(session.getValue("m").toString(),session.getValue("y").toString());
    out.println(totalhits);
    } catch(Exception ex)
    throw new RuntimeException(ex.getMessage());
    }

  • Executin oracle stored procedure from shell script

    Hi everyone,
    I want to know how to execute a orace stored procedure from a shell script not a sql file.
    Its a oracle stored procedure with in parameters.
    Can anyone send immediate reply its very urgent.
    Thanks in Advance
    with regards
    Thazul

    Hello everyone,
    Whenever i am using the previous script
    because of <<! and !>> in the beginging and the end of oracle scrip. Shell is displaying the error 'newline or ;' unxexpeted and the error no is 48.
    After that i used a different script like
    DIRRUNNER=/oracle/tvg
    count=0
    while [ 1 -eq 1 ]
    do
    for x in `ls $DIRRUNNER/RUNNER_*.TXT`
    do
    count=`grep -c $x $DIRRUNNER/runner.log`
    if [ $count -lt 1 ]
    then
    chstr=`echo $x|awk -F/ '{printf $NF }'`
    dir=$DIRRUNNER
    file=$chstr
    PATH=$PATH:/usr/local/bin:.
    export PATH
    ORACLE_SID=BBPROD
    ORAENV_ASK=NO
    . oraenv
    ORAENV_ASK=YES
    echo "exec runrace('$dir', '$file')" > runner.sql
    sqlplus -s tvgus/tvgus@bbprod @runner.sql
    echo $x >>$DIRRUNNER/runner.log
    fi
    done
    count=0
    sleep 2
    done
    The above one is working fine but after executing the procedure control is still remaing in the sqlplus environment, but i want the control back to my shell
    Can anyone help to resolve this, its pretty urgent.
    Thanks in Advance
    Thazul.
    null

  • Executing an Oracle Stored Procedure from Sender JDBC adapter

    I could really use some help from someone who had done this before. 
    I've read the help about using the JDBC sender adapter, but it's not helping enough.
    I found this line: "Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
    The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs."
    That's definately what we want to do, but we can't figure out the syntax.
    The procedure in oracle looks like this:
    CREATE OR REPLACE PROCEDURE test_ref_cursor
    ( cur_generic IN OUT result_sets.cur_generic)
    as
    BEGIN
    Open cur_generic for
    select
       proposal_number,
       to_char(sequence_number),
       column_name,
       column_value,
       update_timestamp,
       update_user
       from
       coeus.sap_test;
    END test_ref_cursor;
    And we have tried every kind of statement we can think of, but the file adapter always gives us an "invalid sql statement" error.
    Does anyone know what syntax we need to put in the "Query SQL Statement" in the JDBC sender adapter in order to call this procedure?  Or is there something wrong with the procedure that is causing the error?
    <i>I will absolutely return and give points, but PLEASE read my whole post before answering and do not just link me to or quote the help for configuring a sender JDBC adapter or blogs that are about the JDBC adapter in general but do not deal with the issues I am having. Thank you.</i>

    Hi Vanda,
    Unfortunately, the sender JDBC adapter does not support Oracle's store procedure/function.  Unlike stored procedures from other database vendors, Oracle returns a cursor, not a resultset.  The sender JDBC adapter must send a resultset to XI.
    There are 2 possible ways you can accomplish this:
    1.  Use BPM and call the Oracle stored procedure using a receiver adapter via a asynch-synch bridge.
    2.  Develop a user-module for the adapter, which can be used with a sender adapter.
    Thanks
    Prasad

  • Error Calling Oracle Stored Procedure From Within Report

    Hi,
    I have a report that calls an oracle stored procedure which returns a ref cursor. The report is working ok in our development environment when called from our development website through .NET.
    When the report is moved and accessed from our UAT website we get the following error :-
    Failed to open a rowset. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for Oracle Description: One or more errors occurred during processing of command. Failed to open a rowset. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for Oracle Description: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'RHS_GET_CAND_SECTION_REFS' ORA-06550: line 1, column 7: PL/SQL: Statement ignored Native Error: Failed to open a rowset. Error in File C:\WINDOWS\TEMP\temp_d663a952-bef6-4bf7-bf1a-5e288afdb612 {9B6DFB38-A436-4940-9D80-B4C23DFFFF19}.rpt: Failed to open a rowset.
    If we open the report manually we are prompted to enter database connection info. If we enter the UAT connection details the report runs ok. If we save the report and try to open it from UAT website through .NET it now opens ok.
    If we then move that same report back to the development environment and open from our development website it fails with the same error above.
    Both connections are using Microsoft OLE DB drivers and the Oracle databases are the same version (10.2.0.1.0).
    Is the connection information being stored in actual report and somehow being used when the report is opened through .NET?
    Any help appreciated
    Regards
    Paul

    Hi,
    Please let me know if the issue occurs with the crystal reports designer, if you are facing issues with the .NET application then a need to create a post [here|SAP Crystal Reports, version for Visual Studio;.
    Regards,
    Hitesh

  • Calling Oracle Stored Procedure from Weblogic.

    Hi All,
    I am using Oracle 11g R2 and weblogic 10.3.5.0
    Do you know if it is possible to call a stored procedure from Weblogic.
    Basically, what I would like to do is to call the following procedure : EXEC DBMS_SESSION.SET_IDENTIFIER('provider_a') when my application connects to my database, "provider_a" being the user used to connect to the oracle schema.
    Thanks.

    Up !
    Thanks.

  • 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

Maybe you are looking for