Getting exception whil calling an oracle stored procedure from java program

Dear All,
I encounter this error in my application when I call only the stored procedure but the view is executing fine from the application and my environment is as follow:
Java 1.4
oracle 10g
oracle jdbc driver:9.2.0.8.0
websphere portal 6.0.0.1
this error is occur from time to time randomly, when it happens, the only workaround is to restart the server..Does anyone have any idea about this error?
Unable to execute stored Procedure in Method
java.lang.NullPointerException
at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.java(Compiled Code))
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1140)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java(Compiled Code))
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java(Compiled Code))
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3606)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:5267)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecute(WSJdbcPreparedStatement.java:632)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.execute(WSJdbcPreparedStatement.java:427)
And sometime I am getting this exception
Unable to execute stored Procedure in Method
java.lang.ArrayIndexOutOfBoundsException: 27787320
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java(Compiled Code))
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1134)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java(Compiled Code))
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java(Compiled Code))
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3606)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:5267)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecute(WSJdbcPreparedStatement.java:632)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.execute(WSJdbcPreparedStatement.java:427)
Thanks
Jay

spacetorrent escribió:
for (int x=0; x <result.size(); x++){
System.out.println(result.get(x));
I can't do this, because result object is a Map, and I need write the Key of the Value to obtain.
So I can do:
result.get("res");And I odtain a *$Proxy3* Object

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?

  • Calling PL/Sql Stored Procedure from java file

    Having problem in calling oracle stored procedure using bc4j.

    in ApplicationModuleImpl you can use following e.g.
    on client side use a custom method to access
    try {
    DBTransaction dBTransaction = getDBTransaction();
    String stmt = "CALL CHANGE_OWNER( ?, ?)";
    CallableStatement callableStatement = dBTransaction.createCallableStatement(stmt,DBTransaction.DEFAULT);
    callableStatement.setString( 1, oldOwner );
    callableStatement.setString( 2, newOwner );
    callableStatement.execute();
    } catch (SQLException ex) {
    throw new JboException(ex);
    }

  • How to call a Oracle Stored Procedure from Excel?

    Hi,
    I am new to Oracle database programming.I have an application in excel which has to update info in every row to the database.I am calling a stored procedure in excel for this.The stored procedure is as follows which is executing without a hitch in Oracle:
    CREATE OR REPLACE PROCEDURE APD_MASS_UPLOAD_UNITS
    (PRODUCT_ID VARCHAR2,Product_Code VARCHAR2, str_Adpt_Grp VARCHAR2,str_Adpt_Type VARCHAR2,
    str_PDC VARCHAR2,str_Release_ID VARCHAR2,str_Created_by VARCHAR2,
    str_Last_Updated_By VARCHAR2, dt_created_Date VARCHAR2,dt_Last_Updated_Date VARCHAR2,
    StrMonth1 VARCHAR2,strMth2 VARCHAR2,StrMth3 VARCHAR2,StrMth4 VARCHAR2,
    StrMth5 VARCHAR2,StrMth6 VARCHAR2,Sample Varchar2,str_message OUT Varchar2)
    AS
    type Month_type is table of VARCHAR2(10) index by binary_integer;
    str_month Month_Type;
    Fac_ID VARCHAR2(20);
    Org_ID VARCHAR2(20);
    Cnt_Units NUMBER;
    i_POS NUMBER;
    i_Month NUMBER;
    i_UNITS NUMBER;
    CURSOR C1 IS
    SELECT * FROM TBLLINE_ADOPT_PLAN WHERE SPEC_ID = Product_ID AND
    ADOPT_GROUP = str_Adpt_Grp AND ADOPT_TYPE = str_Adpt_Type
    AND RELEASE_ID = APD_Get_Release_ID(str_PDC,str_Release_Id);
    CURSOR C2 IS
    SELECT FACILITY_ID FROM TBLADOPT_GROUP_CSC WHERE ADOPT_GROUP = str_Adpt_Grp;
    CURSOR C3 IS
    SELECT ORG_ID FROM APD_DV_PRODUCT_V WHERE SPEC_ID = Product_ID;
    CURSOR C4 IS
    SELECT * FROM TBLPROD_CSC WHERE PROD_SPEC_ID = Product_ID;
    Adopt_Rec C1%ROWTYPE;
    Fac_Rec C2%ROWTYPE;
    PMORG_REC C3%ROWTYPE;
    CSC_Rec C4%ROWTYPE;
    i_Count NUMBER;
    Message VARCHAR2(20);
    BEGIN
    Message := APD_SPECID_VALIDATE(Product_ID,Product_code,Str_PDC, str_Release_ID);
    IF TRIM(Message) is null then
    OPEN C1;
    FETCH C1 INTO Adopt_Rec;
    IF C1%NOTFOUND THEN
    INSERT INTO TBLLINE_ADOPT_PLAN (SPEC_ID,ADOPT_GROUP, ADOPT_TYPE,RELEASE_ID, SAMPLES,CREATED_BY,CREATED_DATE, LAST_UPDATED_BY,LAST_UPDATED_DATE,SAMPLE_ONLY_IND, GRID_TYPE_CD) VALUES
    (Product_ID,str_Adpt_Grp ,str_Adpt_Type,
    APD_Get_Release_ID(str_PDC,str_Release_Id), 0,str_Created_By,
    TO_DATE(dt_Created_Date,'DD/MM/YYYY'),str_Last_Updated_By,
    TO_DATE(dt_Last_Updated_Date,'DD/MM/YYYY'),'N','C');
    END IF;
    CLOSE C1;
    str_Month(1) := strMonth1;
    str_Month(2) := strMth2;
    str_Month(3) := strMth3;
    str_Month(4) := strMth4;
    str_Month(5) := strMth5;
    str_Month(6) := strMth6;
    OPEN C2;
    FETCH C2 INTO Fac_REC;
    Fac_ID := Fac_Rec.FACILITY_ID;
    CLOSE C2;
    OPEN C3;
    FETCH C3 INTO PMORG_Rec;
    Org_ID := PMORG_Rec.Org_ID;
    CLOSE C3;
    OPEN C4;
    FETCH C4 INTO CSC_Rec;
    IF C4%NOTFOUND THEN
    INSERT INTO TBLPROD_CSC(PROD_SPEC_ID,CSC_FACILITY_ID, PROFIT_CENTER_CD,DEFAULT_IND, CREATED_BY, CREATED_DATE, LAST_UPDATED_BY, LAST_UPDATED_DATE) VALUES
    (Product_ID , Fac_ID,Org_id, 'N', str_Created_by ,
    To_date ( dt_Created_Date,'DD/MM/YYYY') ,str_Last_updated_by ,
    To_Date (dt_Last_Updated_Date ,'DD/MM/YYYY'));
    END IF;
    CLOSE C4;
    IF Sample > 0 Then
    UPDATE TBLLINE_ADOPT_PLAN
    SET SAMPLES = Sample
    WHERE SPEC_ID = Product_ID AND
    ADOPT_GROUP = str_adpt_grp AND
    ADOPT_TYPE = str_Adpt_Type AND
    RELEASE_ID = APD_Get_Release_ID(str_PDC,str_Release_Id);
    END IF;
    str_Message := 'Updated';
    END IF;
    END;
    The code to call the stored procedure in Excel is as follows:
    Dim Conn As New ADODB.Connection
    Dim InputParam1 As New ADODB.Parameter
    Dim InputParam2 As New ADODB.Parameter
    Dim InputParam3 As New ADODB.Parameter
    Dim InputParam4 As New ADODB.Parameter
    Dim InputParam5 As New ADODB.Parameter
    Dim InputParam6 As New ADODB.Parameter
    Dim InputParam7 As New ADODB.Parameter
    Dim InputParam8 As New ADODB.Parameter
    Dim InputParam9 As New ADODB.Parameter
    Dim InputParam10 As New ADODB.Parameter
    Dim InputParam11 As New ADODB.Parameter
    Dim InputParam12 As New ADODB.Parameter
    Dim InputParam13 As New ADODB.Parameter
    Dim InputParam14 As New ADODB.Parameter
    Dim InputParam15 As New ADODB.Parameter
    Dim InputParam16 As New ADODB.Parameter
    Dim InputParam17 As New ADODB.Parameter
    Dim InputParam18 As New ADODB.Parameter
    Dim OutputParam As New ADODB.Parameter
    Dim Mth1, Mth2, Mth3, Mth4, Mth5, Mth6 As String
    Dim Rs_data As New ADODB.Recordset
    Conn.ConnectionString = ("Provider=MSDAORA.1;User ID=" & "cnbg" & ";PASSWORD=" & "cnbg" & ";Data Source=" & "DAQ01" & ";Persist Security Info=False")
    Conn.Open
    OraCmd.ActiveConnection = Conn
    OraCmd.CommandText = "APD_MASS_UPLOAD_UNITS"
    OraCmd.CommandType = adCmdStoredProc
    Conn.CursorLocation = adUseClient
    OraCmd.Parameters.Refresh
    Set InputParam1 = OraCmd.CreateParameter("Product_ID", adVarChar, adParamInput, 20)
    InputParam1.Value = spec_id
    Set InputParam2 = OraCmd.CreateParameter("Product_code", adVarChar, adParamInput, 20)
    InputParam2.Value = str_product_code
    Set InputParam3 = OraCmd.CreateParameter("str_Adpt_Type", adVarChar, adParamInput, 10)
    InputParam3.Value = Adopt_Group
    Set InputParam4 = OraCmd.CreateParameter("str_Adpt_Type", adVarChar, adParamInput, 10)
    InputParam4.Value = Adopt_Type
    Set InputParam5 = OraCmd.CreateParameter("str_pdc", adVarChar, adParamInput, 10)
    InputParam5.Value = ThisWorkbook.strDbPDC
    Set InputParam6 = OraCmd.CreateParameter("str_Release_ID", adVarChar, adParamInput, 10)
    InputParam6.Value = str_Release_Id
    Set InputParam7 = OraCmd.CreateParameter("str_created_by", adVarChar, adParamInput, 10)
    InputParam7.Value = ThisWorkbook.User_Name
    Set InputParam8 = OraCmd.CreateParameter("str_last_updated_by", adVarChar, adParamInput, 10)
    InputParam8.Value = ThisWorkbook.User_Name
    Set InputParam9 = OraCmd.CreateParameter("dt_created_date", adVarChar, adParamInput, 10)
    InputParam9.Value = Sheet1.Cells(8, 2)
    Set InputParam10 = OraCmd.CreateParameter("dt_Last_Updated_Date", adVarChar, adParamInput, 10)
    InputParam10.Value = Sheet1.Cells(8, 2)
    Set InputParam11 = OraCmd.CreateParameter("strMonth1", adVarChar, adParamInput, 10)
    InputParam11.Value = Mth1
    Set InputParam12 = OraCmd.CreateParameter("strMth2", adVarChar, adParamInput, 10)
    InputParam12.Value = Mth2
    Set InputParam13 = OraCmd.CreateParameter("strMth3", adVarChar, adParamInput, 10)
    InputParam13.Value = Mth3
    Set InputParam14 = OraCmd.CreateParameter("strMth4", adVarChar, adParamInput, 10)
    InputParam14.Value = Mth4
    Set InputParam15 = OraCmd.CreateParameter("strMth5", adVarChar, adParamInput, 10)
    InputParam15.Value = Mth5
    Set InputParam16 = OraCmd.CreateParameter("strMth6", adVarChar, adParamInput, 10)
    InputParam16.Value = Mth6
    Set InputParam17 = OraCmd.CreateParameter("Sample", adInteger, adParamInput, 10)
    InputParam17.Value = 0
    Set InputParam18 = OraCmd.CreateParameter("str_message", adVarChar, adParamOutput, 10)
    OraCmd.Parameters.Append InputParam1
    OraCmd.Parameters.Append InputParam2
    OraCmd.Parameters.Append InputParam3
    OraCmd.Parameters.Append InputParam4
    OraCmd.Parameters.Append InputParam5
    OraCmd.Parameters.Append InputParam6
    OraCmd.Parameters.Append InputParam7
    OraCmd.Parameters.Append InputParam8
    OraCmd.Parameters.Append InputParam9
    OraCmd.Parameters.Append InputParam10
    OraCmd.Parameters.Append InputParam11
    OraCmd.Parameters.Append InputParam12
    OraCmd.Parameters.Append InputParam13
    OraCmd.Parameters.Append InputParam14
    OraCmd.Parameters.Append InputParam15
    OraCmd.Parameters.Append InputParam16
    OraCmd.Parameters.Append InputParam17
    OraCmd.Parameters.Append InputParam18
    Set Rs_data = New ADODB.Recordset
    Set Rs_data = OraCmd.Execute
    I am getting an error at this point which
    ORA-06550:line 1,column 54:
    PLS-00103:Encountered the symbol ">" when expecting one of the following:
    . ( ) * @ % & = - + < / > at in is mod not rem
    <an exponent(**)> <> or != or ~= or >= <= <> and or like
    between ||
    Can anyone pls help me?Thanks.

    You do not need to code an explicit cursor for a single fetch. An implicit cursor is less code to write, read, maintain and execute.
    E.g. Instead of all this:
    CURSOR C2 IS
    SELECT FACILITY_ID FROM TBLADOPT_GROUP_CSC WHERE ADOPT_GROUP = str_Adpt_Grp;
    OPEN C2;
    FETCH C2 INTO Fac_REC;
    Fac_ID := Fac_Rec.FACILITY_ID;
    CLOSE C2;
    Simply code this:SELECT
    Fac_Rec.FACILITY_ID INTO Fac_ID
    FROM BLADOPT_GROUP_CSC
    WHERE ADOPT_GROUP = str_Adpt_Grp;PL/SQL procedure calls have to be made (to Oracle) as anonymous PL/SQL blocks. This means that you need to wrap the procedure call into BEGIN..END tags.
    So instead of coding this:
    OraCmd.CommandText = "APD_MASS_UPLOAD_UNITS"
    You need to code something like:
    OraCmd.CommandText = "BEGIN APD_MASS_UPLOAD_UNITS; END;"
    However, this will not work as APD_MASS_UPLOAD_UNITS expects a bunch of input parameters. And you're on the right track about attempting to bind your Excel variables' values to the PL/SQL procedure's parameters.
    Unsure how ADO works, but typically you can bind by name or by position. Let's assume bind by position (typically in PHP):
    OraCmd.CommandText = "BEGIN APD_MASS_UPLOAD_UNITS( ?, ?, ?, ?, ?. ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); END;"
    Then you will bind values to positions 1 to 18 (did I count the number of params right?). Something like:
    OraCmd.CreateParameterByPosition( 1, adVarChar, adParamInput, 20)
    Or you can bind by name. E.g.
    OraCmd.CommandText = "BEGIN APD_MASS_UPLOAD_UNITS( :pid, :pcode, ..etc.. ); END;"
    And:
    OraCmd.CreateParameterByName( 'pid', adVarChar, adParamInput, 20)
    Read up on your OraCmd.CreateParameter() to see how to correctly use it.
    A few more comments. 18 parameters in a call is something I would seriously reconsider. It is quite easy to get it wrong - transpose two parameters. It is very difficult to read and check. Very difficult to maintain. It is much safer to rather define a %ROWTYPE structure to pass, or a PL/SQL record structure.
    You are passing date values as VARCHAR2. Rather pass the parameter as the correct data type. E.g.
    create or replace procedure foo( custID number, invoiceDate date )...
    And then when you call it (in your client code), you specify the date string and date format and make it into a date. E.g.
    OraCmd.CommandText = "begin foo( :myCust, TO_DATE(:myDateString,:myDateFormat) ); end;"

  • Problem Calling Oracle Stored Procedure From JAVA

    Hello all. I've been banging my head against this all day:
    Here's the procedure I'm calling:
    GetIDsByLatLonRadius(inLatitude IN NUMBER,
    inLongitude IN NUMBER,
    inRadius IN NUMBER,
    inTableName IN VARCHAR2,
    inIDColName IN VARCHAR2,
    inLatColName IN VARCHAR2,
    inLonColName IN VARCHAR2,
    LocationIDs OUT HomesCom_Types.GenericCursorType,
    ErrorNo OUT VARCHAR2);
    And here's the JAVA code:
    public Hashtable GetInRadius(Hashtable inStruct)
    ResultSet locationIDs = null;
    Hashtable outputHash = new Hashtable();
    float latitude = (float) 30.429;
    float longitude = (float) -84.2585;
    float radius = (float) 10;
    try {
    CallableStatement proc = con.prepareCall("{ call GEOCODING.getidsbylatlonradius(?,?,?,?,?,?,?,?,?) }");
    proc.setFloat(1,latitude);
    proc.setFloat(2,longitude);
    proc.setFloat(3,radius);
    proc.setString(4,"demographics_school");
    proc.setString(5,"onboard_id");
    proc.setString(6,"geocoding_latitude");
    proc.setString(7,"geocoding_longitude");
    proc.registerOutParameter(8,OracleTypes.CURSOR);
    proc.registerOutParameter(9,OracleTypes.VARCHAR);
    proc.execute();
    locationIDs = (ResultSet) proc.getObject(1);
    if (locationIDs != null)
    outputHash.put("query",locationIDs);
    else
    outputHash.put("query","LOCATION ID WAS NULL");
    catch(SQLException sqlException) {  
    System.out.println(
    "The following error occured in reading " +
    "from the table: "
    + sqlException);
    outputHash.put("error",sqlException.getMessage());
    return outputHash;
    This catches and the sqlException I get is: Unhandled sql type
    I'm not a java expert and I'm completely stuck at this point, so I figured a few more eyes on it might help.
    Thanks in advance,
    Danny

    Danny,
    Don't print merely the error message, print the whole stack trace.
    Then post it here.
    What java version are you using?
    What JDBC driver and version are you using?
    What Oracle database version are you using?
    Is the code from a Java ServerPages (JSP) or from a Java Stored Procedure (JSP)?
    I guess "HomesCom_Types" is one of your PL/SQL packages or routines, right?
    If so, then you can't use it in JDBC, you must define a database type using the command:
    create or replace type ...But in later versions of the Oracle database, the REF CURSOR type is built-in.
    Check the Oracle documentation for more details.
    Good Luck,
    Avi.

  • Calling Oracle stored procedure from java

    The following query calls a stored procedure TRANSLATE_ZONEPATH_ID defined in a package MT by the user MTDBA. currentZone is a member variable of the class, and currently has value 1
    This query works just fine when I run it from SQLPlus* connected as MTDBA.
    But from java, the following piece throws exception saying "invalid column name"
    String query = "SELECT MTDBA.MT.TRANSLATE_ZONEPATH_ID('"+currentZone+"') "
    + "FROM DUAL ";
    try
    Statement stmt = conn.createStatement();
    ResultSet rst = stmt.executeQuery(query);
    if (rst.next())
    fullName = rst.getString(1);
    stmt.close();
    Anyone got any clue ?

    I always use CallableStatement to execute a stored procedure or function in a database (Oracle).
    try this:
    <code>
    CallableStatement cs = dbConnection.prepareCall("{ ? =
    MTDBA.MT.TRANSLATE_ZONEPATH_ID(?)}");
    cs.setString(1, currentZone);
    cs.registerOutParameter(1, Types.VARCHAR);
    cs.executeUpdate();
    fullname = cs.getString(1);
    cs.close();
    </code>
    There is also a jdbc forum, where your should post this kind of problem :-)
    Hope this help's
    ThK

  • How to call stored procedures from java program?

    I have tried to run a program that calls a stored procedure on MySQL
    server version 5.0.17 by using connector/j 5.0, but it always fails on the
    statement: con.preparecall() ,
    have looked on the internet and found out that people can all mysql
    stored procedure all right in their programs, really dont know what's
    wrong with this small peiece of code:
    import java.sql.*;
    public class TestDB {
          // procedure being called is:
         CREATE PROCEDURE `dbsaystorm`.`getsite` ()
         BEGIN
            select  name  from tblsite;
         END
         public static void main(String[] args) {
              try  {
                  //Class.forName("org.gjt.mm.mysql.Driver");
                  Class.forName("com.mysql.jdbc.Driver");
                  Connection con = DriverManager.getConnection("jdbc:mysql://localhost/dbname",
                            "user", "pwd");
           * executing SQL statement here gives perfect correct results:
            // PreparedStatement ps = con.prepareStatement("select name from tblsite");      
            // ResultSet rs =ps.executeQuery();
                  // but in stored procedure way...
                  //it fails here on this prepare call statement:             
                  CallableStatement proc = con.prepareCall("call getsite()");
                  ResultSet rs =proc.executeQuery();                      
                  if (rs == null) return;                                      
                  while (rs.next()){                 
                      System.out.println("site name is: "+ rs.getString(1));                                
                  rs.close();
              } catch (SQLException e) {e.printStackTrace();}
               catch (Exception e) {e.printStackTrace();}         
    }it always gives this exception:
    java.lang.NullPointerException
         at com.mysql.jdbc.StringUtils.indexOfIgnoreCaseRespectQuotes(StringUtils.java:959)
         at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1280)
         at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:3668)
         at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:638)
         at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:453)
         at com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4365)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4439)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4413)
         at saystorm.server.data.database.TestDB.main(TestDB.java:29)
    where have I gone wrong?
    when I commented out the statement that makes the procedure call and call preparedstatement to execute SQL select statement, it gave perfectly correct result.
    it looks like there is no problem with java prog accessing MYSQL server database, but the it seems that it's just java can't call stored procedure stored on the mysql server version 5.
    can it or can't it? if it can, how is that accomplished?

    It is a bug in the driver because it shouldn't be
    returning that exception (null pointer) even if you
    are doing something wrong.
    Are you using the latest version of the driver?
    The stored procedure runs when you run it from the
    gui/command line using a MySQL tool - correct?
    As suggested you should be using the brackets. What
    is the data type of the 'name' field?
    You could try returning another value like one of the
    following
    select 1, name from tblsite;
    select name, 1 from tblsite;
    That might get around the bug
    Additionally try just the following...
    select 'test' from tblsite;yes, the driver used is in connector/j 5.0--the lastest one, and the
    procedure can run correctedly at either command line or GUI mode
    with no problem whatsoever, the returned data type is string type,
    I have not got the chance to test it again with those values you
    suggested, as I have abandoned the laptop I used to write that code
    initately. There have been some other really weird cases happened on
    that computer. I guess that must be something wrong with the JVM
    installed on it, it was upgraded from jre5.0.04 to 06, and to 09.
    something within hte JVM must have been messed up(the only reasonable
    explanation). Because the same code runs correctly on my new laptop,
    using the same environment: jvm 5.0_09, mysql 5.0.18, connector/J 5.0.
    that old laptop really was a nightmare.

  • How to fetch %ROWTYPE OUT param of  a stored procedure from Java program?

    I have a stored procedure that has IN / OUT parameter as table_name%ROWTYPE.
    From a java program how can I access this ROWTYPE variable?
    I tried all possible documentation and none of the explains whether or not this is supported.
    My use case expect exactly 1 record from the procedure and we would prefer not to use REF CURSOR.
    Is there a way to achieve this? If so, can someone help me with it by posting the sample code to achieve this?
    I tried all the possible OracleTypes to register the OutParameter and they all fail.
    Looks like there isn't any equivalent of %ROWTYPE in OracleTypes either.
    If you need, I can post my sample procedure that uses %ROWTYPE as OUT parameter.
    I really appreciate your help in this regard.
    - Karthik

    Hi,
    If "returning only 1 record" the showstopper for not using Ref Cursor, you might want to reconsider because as you probably know, the ref cursor is only a pointer and requires additional step to retrieve the data.
    Kuassi

  • Passing PL/SQL Record to a Oracle Stored Procedure from Java.

    Hi There.
    Can someone let me know how to pass pl/sql records in java/oa framework. For E.g :
    Package Specification:
    create or replace package pkg is
    type rec_type is record (n number, d date, v varchar2(1));
    rec rec_type;
    procedure p (r IN rec_type);
    end ;
    Package body :
    create or replace package body pkg is
    procedure p (r IN rec_type) is
    begin
    dbms_output.put_line('The values passed to the procedure are' || r.n||r.d||r.v);
    end p ;
    end pkg;
    Actual pl/sql Call (I need counter part of below code in Java)
    declare
    r1 pkg.rec%type;
    begin
    r1.n := 7; r1.d := sysdate; r1.v := 'R';
    pkg.p(r1); -- > How to do similar call using OracleCallableStatement
    end;

    Hi
    I am not sure whether you have check [this.|http://mukx.blogspot.com/2007/12/passing-plsql-table-to-java-using.html]
    Thanks
    Shailendra

  • 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

  • Calling Stored Procedures from JAVA Application

    Hi all,
    i am using JDeveloper 3.2.2 for creating a DB Application that
    uses Oracle8i as DB Server.
    One approach of the application is to only use PL/SQL Stored
    Procedures to write Data back to the DB.
    Some of the stored procedures expect more than 20 parameters.
    I want to know if there is a better way to call such a stored
    procedure from Java than using a CallableStatement and setting
    its 20 parameters.
    Another reason why the way above isnt possible for me is that
    i need a dynamic way to set the parameters of the stored
    procedure.
    A solution for that dynamic way i could think of is to get
    the information of the stored procedure by using some functions
    of DatabaseMetaData and than use this information to map the
    parameters with their respective variables in the java
    application.
    The best argument against this way is that it would be time and
    performance consuming.
    So could anybody tell me a solution to call PL/SQL stored
    procedures from java which is better than doing something like:
    String calString = "{Call myStoredProc(";
    while(counter < 22) {
    params += "?";
    if(counter<21) params += ",";
    counter++;
    calString += params + ")}";
    try {
    CallableStatement cs = session.prepareCall(calString);
    } catch(SQLException ex) { ... }
    cs.setString(1, var1);
    cs.setString(1, var2);
    And that for every Stored Procedure i want to call ?!?
    Any help or direction-leading would be really appreciated.
    Tank you much.
    MfG,
    Oliver Bankel

    Hi Oliver,
    If you your Stored Procedures were in Java and seamlessly
    integrated with your Java application would that make your life
    easier?
    I don't know if this is a practical or acceptable solution in
    your environment but it would certainly solve all of your issues
    and provide your with a couple of nice advantages. Scalability
    and platform independence are just a couple I could think of.
    There is a tool called in2j (see http://www.in2j.com) which will
    automatically migrate your PL/SQL Stored Procedures into Java.
    You can download a copy of the tool and migrate your PL/SQL to
    Java with no upfront costs. If you're happy with the generated
    Java and want to deploy it, the migration fee falls due - simple.
    Hope this helps.
    Elton

  • Calling a Oracle Stored Procedure which will take a while to complete

    Hey.
    I'm calling a Oracle stored procedure which goes of and do a whole lot of things and therefore takes a fair while to complete.
    Currently I am doing this:
    String sql = "begin concorde.start_transfer(); end;";
    HibernateUtil.getSessionFactory().openStatelessSession().connection().prepareCall(sql).execute();
    ....Where HibernateUtil is just a mean to get to the SessionFactory. The connection I get is the same one as a JDBC, I think.
    I would want to regain control of the application as soon as the procedure is called and continue with the rest of the logic.
    How do I do that? Do I have to initiate it from a different thread?
    Thanks

    If it was me I wouldn't have a stored proc that took a while to complete. Instead I would submit a job to job queue. In terms of implementation I would call a proc that writes a record to a table. Then a process in the database polls that table and runs jobs it finds there. Then reports results somewhere.
    Sometime later you collect the results.
    But without that then the solution in java is obvious - create a thread.

  • Error while calling stored procedure from Java

    Hi Guys,
    How are you everybody? I hope everything is goin fine on your side. I have one issue in PL/SQL while calling below stored procedures from Java.
    Problem Description: We have a stored procedure PROCEDURE BULK_INSERTS (
    V_SESSION_ID_TAB IN T_SESSION_ID_TAB_TYPE,
    V_SERVICE_TYPE_TAB IN T_SERVICE_TYPE_TAB_TYPE,
    V_SERVICE_LOCATION_TAB IN T_SERVICE_LOCATION_TAB_TYPE,
    V_SERVICE_CALL_NAME_TAB IN T_SERVICE_CALL_NAME_TAB_TYPE,
    V_SERVICE_CALL_START_TIME_TAB IN T_SERVICE_CALL_ST_TAB_TYPE,
    V_SERVICE_CALL_END_TIME_TAB IN T_SERVICE_CALL_ET_TAB_TYPE,
    V_SERVICE_CALL_DURATION_TAB IN T_SERVICE_CALL_DUR_TAB_TYPE,
    V_STATUS_TAB IN T_STATUS_TAB_TYPE,
    V_NOTES_TAB IN T_NOTES_TAB_TYPE
    ) and we are getting ora errors while calling this stored procedure from java.
    All tab types are declared locally, at package level.
    Here is error which occur while calling this sp:
    {call BULK_PKG.BULK_INSERTS(?,?,?,?,?,?,?,?,?)}
    And the parameter types we are using are:
    SESSION_ID - NUM_TAB_TYPE
    SERVICE_TYPE - VAR_TAB_TYPE
    SERVICE_LOCATION - VAR_TAB_TYPE
    SERVICE_CALL_NAME - VAR_TAB_TYPE
    SERVICE_CALL_START_TIME - DATE_TIME_TAB_TYPE
    SERVICE_CALL_END_TIME - DATE_TIME_TAB_TYPE
    SERVICE_CALL_DURATION - NUM_TAB_TYPE
    STATUS - VAR_TAB_TYPE
    NOTES - VAR_TAB_TYPE
    And the Exception stack trace is:
    ERROR (com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServi
    ceCallDAO.java:143)@ExecuteThread: '252' for queue: 'weblogic.kernel.Default') {Error attempting to save collected ESC data}
    java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:191)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:944)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3482)
    at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:3856)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1373)
    at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:98)
    at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.doBulkInsert(ExternalServiceCallDAO.java:220)
    at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServiceCallDAO.java:138)
    Please help my guys out of this. I will really appreciate all suggestions and advices.
    Thank you everybody.

    I am trying to pass parameter to test my procedure but it is giving this error : ORA-06531: Reference to uninitialized collection
    ORA-06512: at line 12
    Here is example for my test procedure:
    declare
    v_session_id_tab SESSION_ID_TAB_TYPE;
    v_service_type_tab SERVICE_TYPE_TAB_TYPE ;
    v_service_location_tab SERVICE_LOCATION_TAB_TYPE ;
    v_service_call_name_tab SERVICE_CALL_NAME_TAB_TYPE;
    v_service_call_start_time_tab SERVICE_CALL_ST_TAB_TYPE;
    v_service_call_end_time_tab SERVICE_CALL_ET_TAB_TYPE;
    v_service_call_duration_tab SERVICE_CALL_DUR_TAB_TYPE;
    v_status_tab STATUS_TAB_TYPE;
    v_notes_tab NOTES_TAB_TYPE;
    begin
    v_session_id_tab(1) := 1;
    v_service_type_tab(1) := 'db';
    v_service_location_tab(1) := 'local';
    v_service_call_name_tab(1) := 'Name of call';
    v_service_call_start_time_tab(1) := SYSDATE;
    v_service_call_end_time_tab(1) := SYSDATE;
    v_service_call_duration_tab(1) := 100;
    v_status_tab(1) := 'Z';
    v_notes_tab(1) := 'NOTES';
    BULK_INSERTS (v_session_id_tab,v_service_type_tab, v_service_location_tab,v_service_call_name_tab,v_service_call_start_time_tab,v_service_call_end_time_tab,
    v_service_call_duration_tab, v_status_tab, v_notes_tab);
    end;
    I declare all types at schema level.
    Please give your comments.
    Thank you

  • Call to Oracle stored procedure that returns ref cursor doesn't work

    I'm trying to use an OData service operation with Entity Framework to call an Oracle stored procedure that takes an number as an input parameter and returns a ref cursor. The client is javascript so I'm using the rest console to test my endpoints. I have been able to successful call a regular Oracle stored procedure that takes a number parameter but doesn't return anything so I think I have the different component interactions correct. When I try calling the proc that has an ref cursor for the output I get the following an error "Invalid number or type of parameters". Here are my specifics:
    App.config
    <oracle.dataaccess.client>
    <settings>
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.0" value="implicitRefCursor metadata='ColumnName=WINDFARM_ID;BaseColumnName=WINDFARM_ID;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Number;ProviderType=Int32'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.1" value="implicitRefCursor metadata='ColumnName=STARTTIME;BaseColumnName=STARTTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.2" value="implicitRefCursor metadata='ColumnName=ENDTIME;BaseColumnName=ENDTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.3" value="implicitRefCursor metadata='ColumnName=TURBINE_NUMBER;BaseColumnName=TURBINE_NUMBER;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.4" value="implicitRefCursor metadata='ColumnName=NOTES;BaseColumnName=NOTES;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.5" value="implicitRefCursor metadata='ColumnName=TECHNICIAN_NAME;BaseColumnName=TECHNICIAN_NAME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
    </settings>
    OData Service Operation:
    public class OracleODataService : DataService<OracleEntities>
    // This method is called only once to initialize service-wide policies.
    public static void InitializeService(DataServiceConfiguration config)
    // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
    // Examples:
    config.SetEntitySetAccessRule("*", EntitySetRights.All);
    config.SetServiceOperationAccessRule("GetWorkOrdersByWindfarmId", ServiceOperationRights.All);
    config.SetServiceOperationAccessRule("CreateWorkOrder", ServiceOperationRights.All);
    config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    [WebGet]
    public IQueryable<GetWorkOrdersByWindfarmId_Result> GetWorkOrdersByWindfarmId(int WindfarmId)
    return this.CurrentDataSource.GetWorkOrdersByWindfarmId(WindfarmId).AsQueryable();
    [WebGet]
    public void CreateWorkOrder(int WindfarmId)
    this.CurrentDataSource.CreateWorkOrder(WindfarmId);
    Here is the stored procedure:
    procedure GetWorkOrdersByWindFarmId(WINDFARMID IN NUMBER,
    P_RESULTS OUT REF_CUR) is
    begin
    OPEN P_RESULTS FOR
    select WINDFARM_ID,
    STARTTIME,
    ENDTIME,
    TURBINE_NUMBER,
    NOTES,
    TECHNICIAN_NAME
    from WORKORDERS
    where WINDFARM_ID = WINDFARMID;
    end GetWorkOrdersByWindFarmId;
    I defined a function import for the stored procedure using the directions I found online by creating a new complex type. I don't know if I should be defining the input parameter, WindfarmId, in my app.config? If I should what would that format look like? I also don't know if I'm invoking the stored procedure correctly in my service operation? I'm testing everything through the rest console because the client consuming this information is written in javascript and expecting a json format. Any help is appreciated!
    Edited by: 1001323 on Apr 20, 2013 8:04 AM
    Edited by: jennyh on Apr 22, 2013 9:00 AM

    Making the change you suggested still resulted in the same Oracle.DataAccess.Client.OracleException {"ORA-06550: line 1, column 8:\nPLS-00306: wrong number or types of arguments in call to 'GETWORKORDERSBYWINDFARMID'\nORA-06550: line 1, column 8:\nPL/SQL: Statement ignored"}     System.Exception {Oracle.DataAccess.Client.OracleException}
    I keep thinking it has to do with my oracle.dataaccess.client settings in App.Config because I don't actually put the WindfarmId and an input parameter. I tried a few different ways to do this but can't find the correct format.

  • 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

Maybe you are looking for

  • Unable to open hyperlink in pdf

    Hi All, I created a new Deski report and i created a hyperlink variable, which works perfect in the report. Now, when the report is exported to pdf the hyperlink changes, it adds an extra % in the hyperlink and does not work. Variable: =If Match(<Mon

  • TS1368 Accessing itunes store

    I have reinstalled itunes onto my PC but am still not able to access the itunes store.

  • Submit XML filename

    Hi, Is it possible to change the XML file that gets submitted out of a LCD created PDF via email? At the moment the filename is some gibberish or sometimes its the PDF's filename. Anyone that can explain how the filename gets assigned would be most h

  • How do I re-install cs3 on Windows 8?

    I uninstalled cs3 on Windows 8 because an error came up when I tried to open the program.  It said to uninstall the program and then re-install it.  Now I can't re-install it on windows 8.  Error keeps occurring saying "Component install failed" for

  • Can I re-order a book that I no longer have in iphoto?

    I ordered two books in march and got them perfectly fine. I erased this book from my iphoto, but would like to know if I can get another set of these books?