Stored procedure output parameter cast problem

Hi
I call to an oracle stored procedure from java and when i get the output parameter i get a classCastException.
The output parameter is for example of typeA
typeA is a sql object composed by a parameter of typeB and a parameter of typeC
typeB is a sql table of typeD objects
and typeD, typeB are objects composed by numbers, varchar2, date.....
I know that i have all the java to sql mappings correctly done because when my typeA is an input parameter of a procedure, it works correctly.
But when i have it as an output parameter i can�t solve the classCastException.
This is more or less my java code to call to the procedure:
dbConn=DriverManager.getConnection(dnsName,dnsUser,dnsPwd);
Map map = dbConn.getTypeMap();          
map.put("TYPEA", Class.forName("tiposOracle.inv.Inv"));               
map.put("TYPEB", Class.forName("tiposOracle.inv.Inv_cab"));               
map.put("TYPED", Class.forName("tiposOracle.inv.Inv_lin"));
CallableStatement cstmt = dbConn.prepareCall("{call GENERAL.OBTENER_MENSAJE (?,?)}");
cstmt.setBigDecimal(1, codMensaje);
cstmt.registerOutParameter(2, OracleTypes.STRUCT, "TYPEA");
cstmt.execute();
Inv inv = (Inv)cstmt.getObject(2,map);       ////////Here the exception-----------------------------------------------------------------------------------------------
The java class Inv represents the sql object typeA as this:
public Inv_cab cab;
public ARRAY lins;
And the classes Inv_cab and Inv_lin typeB and typeD with dates, BigDecimals and String.
lins is the table of Inv_lin.
And finally, this is the exception i get:
java.lang.ClassCastException
     at tiposOracle.inv.Inv.readSQL(Invrpt.java:29)
     at oracle.sql.STRUCT.toClass(STRUCT.java:829)
     at oracle.sql.STRUCT.toJdbc(STRUCT.java:734)
     at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:6094)
     at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:840)
     at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:103)
Can anyone help me?
Thanks

Now i get this exception in cstmt.registerOutParameter(2, OracleTypes.STRUCT);java.sql.SQLException: Conflicto de tipo de par�metro: sqlType=2002
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
     at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:248)
     at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:402)
     at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:471)
     at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:78)
Conflicto de tipo de par�metro means: conflict of parameter type

Similar Messages

  • Stored procedure output parameter cast problem - there was a mistake in the

    Hi
    I call to an oracle stored procedure from java and when i get the output parameter i get a classCastException.
    The output parameter is for example of typeA
    typeA is a sql object composed by a parameter of typeB and a parameter of typeC
    typeC is a sql table of typeD objects
    and typeD, typeB are objects composed by numbers, varchar2, date.....
    I know that i have all the java to sql mappings correctly done because when my typeA is an input parameter of a procedure, it works correctly.
    But when i have it as an output parameter i can�t solve the classCastException.
    This is more or less my java code to call to the procedure:
    dbConn=DriverManager.getConnection(dnsName,dnsUser,dnsPwd);
    Map map = dbConn.getTypeMap();          
    map.put("TYPEA", Class.forName("tiposOracle.inv.Inv"));               
    map.put("TYPEB", Class.forName("tiposOracle.inv.Inv_cab"));               
    map.put("TYPED", Class.forName("tiposOracle.inv.Inv_lin"));
    CallableStatement cstmt = dbConn.prepareCall("{call GENERAL.OBTENER_MENSAJE (?,?)}");
    cstmt.setBigDecimal(1, codMensaje);
    cstmt.registerOutParameter(2, OracleTypes.STRUCT, "TYPEA");
    cstmt.execute();
    Inv inv = (Inv)cstmt.getObject(2,map);       ////////Here the exception-----------------------------------------------------------------------------------------------
    The java class Inv represents the sql object typeA as this:
    public Inv_cab cab;
    public ARRAY lins;
    And the classes Inv_cab and Inv_lin typeB and typeD with dates, BigDecimals and String.
    lins is the table of Inv_lin.
    And finally, this is the exception i get:
    java.lang.ClassCastException
    at tiposOracle.inv.Inv.readSQL(Invrpt.java:29)
    at oracle.sql.STRUCT.toClass(STRUCT.java:829)
    at oracle.sql.STRUCT.toJdbc(STRUCT.java:734)
    at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:6094)
    at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:840)
    at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:103)
    Can anyone help me?
    Thanks

    Now i get this exception in cstmt.registerOutParameter(2, OracleTypes.STRUCT);java.sql.SQLException: Conflicto de tipo de par�metro: sqlType=2002
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:248)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:402)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:471)
         at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:78)
    Conflicto de tipo de par�metro means: conflict of parameter type

  • How to retrieve Stored Procedure Output Parameter?

    Hi,
    I'm using a stored procedure with MS SQL Server. The stored procedure creates the required table entries correctly. After executing the procedure i free the resulting recordset reference and am able to retrieve the return value of the stored procedure. However,
    I am not able to retrieve the output parameters of the procedure. I am connected to the database using the MS OLE DB Provider for SQL Server. I tried using ODBC as well. Didn't work either. I know this issue has been addressed before, did anyone come up with a solution for this problem?
    Thanks in advance,
    Marco

    I can tell you what I do with LabSQL and a single output parameter. After I open the connection to the database, I execute a SQL statement that looks like this:
    declare @resultID int
    execute spInsUUTResult @SerialNumber = '999DEBUGXXX',
    @SequenceName = 'Sequence File2.seq',
    @CategoryID = 2,
    @TypeID = 1,
    @StartDateTime = '10-10-2003 13:42:45',
    @ExecutionTime = 3.5698713,
    @UUTStatus = 'Passed',
    @UserName = 'Dennis Knutson',
    @StationName = 'DENNIS-KNUTSON',
    @UUTResultID = @resultID OUTPUT
    This query result is the output parameter. I first debugged the call to the stored procedure in the SQL Server Query Analyzer and then just copied that straight into my LabVIEW code. You may be using something other than LabSQL but you should have a function t
    hat allows for raw SQL commands.

  • Output Parameter cast problems

    Wondering if anyone has seen this ...
    Migrating a data access layer (based on the MS DAAB) using the ODP.NET provider. I wrote my own parameter discovery code to dynamically configure parameters at runtime - just like the SqlCommandBuilder.DeriveParameters() method does for SQL Server sprocs.
    (I query the "all_arguments" view to get this data, by the way, passing the package name and procedure name.)
    Here's the problem: you cannot discover the Size property for a parameter via this query. Bummer. So for VarChar2 and Char types I tried setting the Size to somethng big, like 2000.
    When I retrieve the parameters after an ExecuteNonQuery statement, I am getting Type cast errors:
    "Cast from type 'OracleString' to type 'String' is not valid"
    Here's the weird part:
    - CType(params(5).Value, Integer) 'WORKS
    - CType(params(2).Value, String) 'DOESN'T WORK
    - params(2).Value.ToString 'WORKS
    - CType(params(2).Value, Date) 'DOESN'T WORK
    What the ...? Why can't I cast a VarChar2 or Char type back to a .NET String? Why does ToString work but Ctype() not work?
    I hope somebody can offer guidance, I've got a lot invested in this DAL :-)
    Thanks eh
    Kurt Mang
    Vancouver BC

    There's not really an elegant way to provide these conversions in VB. In C# OracleString uses operator overloading to provide type conversions, but this version of VB doesn't support it.
    They might have implemented IConvertible on the oracle types.
    Then you could write
    Dim osw as new OracleString("Hello")
    Dim s as String = CType(osw, IConvertible).ToString
    But that's not really better than
    Dim osw as new OracleString("Hello")
    Dim s as String = osw.Value
    The long and short of it is, OracleTypes ( and other ADO.NET provider types), are special high-performance types (usually value types), and they convert using a different idiom. By convention they are converted to the corresponding framework type using a property called .Value, and constructed from framework types using a constructor.
    String s = New OracleString("Hello").Value
    Converts the Unicode string "Hello" to an OracleString structure, and then back to a unicode string.
    David

  • VARRAY as Stored Proc output parameter

    VARRAY as Stored Proc output parameter
    I have an Oracle VARRAY data type declared as follows:
    CREATE TYPE NUMBER_ARRAY AS VARRAY(100) OF NUMBER;
    I have a stored procedure which takes a single input and
    returns a NUMBER_ARRAY as output:
    CREATE OR REPLACE PROCEDURE one_in_number_array_out(
    IN_PARAM IN NUMBER,
    OUT_NUMBER_ARRAY OUT NUMBER_ARRAY )
    IS
    BEGIN
    -- OUT_NUMBER_ARRAY getting populated here
    END one_in_number_array_out;
    I want to be able hit this proc using TopLink StoreProcedureCall objects and retrieve through a map.
    I thought I would be able to do something like:
    public void execute() {
         StoredProcedureCall call = new StoredProcedureCall();
              call.setProcedureName( getStoredProcedureName() );
              call.addNamedArgumentValue("IN_NUMBER_PARAM", new Double(324) );
              call.addNamedOutputArgument("OUT_NUMBER_ARRAY", "numberArray"); // use an alias
         ClientSession clientSession = .....getClientSession();
    // EXCEPTION OCCURS on following call:
              Map row = (Map) clientSession.executeSelectingCall( call ).firstElement();
              Object numberArray = row.get( "numberArray" );
              System.out.println("numberArray = " + numberArray);
    But, when I call the stored proc I get the following stack trace:
    LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'ONE_IN_NUMBER_ARRAY_OUT'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    INTERNAL EXCEPTION: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'ONE_IN_NUMBER_ARRAY_OUT'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    ERROR CODE: 6550
         at oracle.toplink.exceptions.DatabaseException.sqlException(Unknown Source)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(Unknown Source)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown Source)
         at oracle.toplink.threetier.ServerSession.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelectCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelect(Unknown Source)
         at oracle.toplink.queryframework.DataReadQuery.executeNonCursor(Unknown Source)
         at oracle.toplink.queryframework.DataReadQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.ReadQuery.execute(Unknown Source)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
         at oracle.toplink.threetier.ServerSession.internalExecuteQuery(Unknown Source)
         at oracle.toplink.threetier.ClientSession.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeSelectingCall(Unknown Source)
         at com.gs.lab.rr.db.plsql.gs_practice_pkg.OneInNumberArrayOutStoredProcedure.execute(OneInNumberArrayOutStoredProcedure.java:51)
         at com.gs.lab.rr.db.plsql.gs_practice_pkg.PracticeStoredProceduresTest.testOneInNumberArrayOutStoredProcedure(PracticeStoredProceduresTest.java:54)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:329)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:218)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:151)
    INTERNAL EXCEPTION STACK:
    java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'ONE_IN_NUMBER_ARRAY_OUT'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(Unknown Source)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown Source)
         at oracle.toplink.threetier.ServerSession.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelectCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelect(Unknown Source)
         at oracle.toplink.queryframework.DataReadQuery.executeNonCursor(Unknown Source)
         at oracle.toplink.queryframework.DataReadQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.ReadQuery.execute(Unknown Source)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
         at oracle.toplink.threetier.ServerSession.internalExecuteQuery(Unknown Source)
         at oracle.toplink.threetier.ClientSession.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeSelectingCall(Unknown Source)
         at com.gs.lab.rr.db.plsql.gs_practice_pkg.OneInNumberArrayOutStoredProcedure.execute(OneInNumberArrayOutStoredProcedure.java:51)
         at com.gs.lab.rr.db.plsql.gs_practice_pkg.PracticeStoredProceduresTest.testOneInNumberArrayOutStoredProcedure(PracticeStoredProceduresTest.java:54)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:329)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:218)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:151)
    Thanks in advance,
    John

    Using the SQL/ObjectRelational types as stored procedure arguments is not supported. But it may work...
    You should not pass in the reference to the array type. Instead, do something like this:
    call.addNamedOutputArgument("OUT_NUMBER_ARRAY", "OUT_NUMBER_ARRAY");
    Hope this helps. If not, I suspect it would take some technical services to do this as I don't think the source.zip contains the classes involved in this.
    - Don

  • How to move stored procedure output to file

    Hi All,
    Thanks in advance.
    Please let me know how to move the oracle stored procedure output to the flat file.
    By
    Pyarajan

    Hi Pyarajan,
    As David posted, in the Data Flow Task (DFT), you can add an OLE DB Source, and create a connection manager to connect to the Oracle server using the Microsoft OLE DB for Oracle provider. Then, in the OLE DB Source Editor, you can set the “Data access mode”
    to “SQL command” and input the query to execute your Oracle stored procedure. To export the data to a flat file, we need to add a Flat File Destination to the DFT.
    Besides, also note that you need to install the Oracle client on this server, and you may need to edit the tnsnames.ora and sqlnet.ora files to establish the connection to Oracle successfully.
    References:
    http://commerceserverguy.wordpress.com/2011/12/04/ssis-package-tutorial/ 
    http://sqlblog.com/blogs/jorg_klein/archive/2011/06/09/ssis-connect-to-oracle-on-a-64-bit-machine.aspx 
    Regards,
    Mike Yin
    TechNet Community Support

  • Stored procedure OUTPUT VARCHAR2 value truncated using 12c client on Server 2012

    Questions:
    1) Is there a version of Oracle Client 11g which runs on Server 2012? My 11.2.0.0, when the installer begins, says my Server 2012 (8GB mem, 80 GB drive) does not meet the minimum requirements and I should not install it. This same installer worked on Server 2008.
    2) Have you seen the following behavior from Oracle client 12c? Are there any patches?
    When I was unable to find a version of Oracle 11g client for Windows Server 2012, I downloaded Oracle 12c. We have a few stored procedures, when invoked from a Windows Server 2008 with an 11g client work. However, when running that some code on a Windows Server 2012 machine does not work. I have certain stored procedures with an OUTPUT parameter when executed on 2012 has the values truncated.
    For instance:
    Output parameter is set to return "SUCCESS", but was is received is "SUC"
    Ouput parameter is set to return "AllSet", but it returns "All"
    Output parameter is set to cast a NUMBER to a VARCHAR2 and the value is a 5 digit number, but only the first two digits are returned. Ex: "83976", but only "83" appears.
    The above takes place when run from Server 2012, but works fine from Server 2008 and Win 7.

    Questions:
    1) Is there a version of Oracle Client 11g which runs on Server 2012? My 11.2.0.0, when the installer begins, says my Server 2012 (8GB mem, 80 GB drive) does not meet the minimum requirements and I should not install it. This same installer worked on Server 2008.
    2) Have you seen the following behavior from Oracle client 12c? Are there any patches?
    When I was unable to find a version of Oracle 11g client for Windows Server 2012, I downloaded Oracle 12c. We have a few stored procedures, when invoked from a Windows Server 2008 with an 11g client work. However, when running that some code on a Windows Server 2012 machine does not work. I have certain stored procedures with an OUTPUT parameter when executed on 2012 has the values truncated.
    For instance:
    Output parameter is set to return "SUCCESS", but was is received is "SUC"
    Ouput parameter is set to return "AllSet", but it returns "All"
    Output parameter is set to cast a NUMBER to a VARCHAR2 and the value is a 5 digit number, but only the first two digits are returned. Ex: "83976", but only "83" appears.
    The above takes place when run from Server 2012, but works fine from Server 2008 and Win 7.

  • Assigning stored procedure output value to java variable

    I have one stored procedure which is having ref cursor as the output parameter.
    How to assign refcursor value to my java variable?

    cstmt.registerOutParameter(1, OracleTypes.CURSOR);
    cstmt.execute()
    ResultSet rs = (ResultSet)cstmt.getObject(1);
    ==
    Ashok

  • Stored Procedure Output Issue in Query Template

    Hi,
    We have written a stored procedure which returns 3 outputs which are of type CLOB. Whenever we call the procedure from query template it gives an error Wrong number or type of parameters. It seems that we need to pass some variables which are of type clob to the procedure while calling which we cannot do as per my knowledge in query template.
    Even if we are able to get the output we will not be getting complete output since the out put values are of type CLOB.
    Can you guide me how to achive this
    Thanks,
    Shalaka

    Hi,
    Sometime back i faced the similar problem. But I used oracle pipelined functions to achieve this....
    The basic thing is it will break the chunk into records of length of 4000 chars and it will return in a table. And from other end you can loop and concatenate. Hope this helps....
    create or replace FUNCTION FN_GEN_XML RETURN dashb_xml pipelined IS v_xml CLOB := NULL;
    v_temp VARCHAR2(4000) := NULL;
    v_counter NUMBER := 1;
    BEGIN
      SELECT somefunction(0)
      INTO v_xml
      FROM dual;--v_xml here is clob type. here you might need to call your proc and get it into this variable.
      dbms_output.put_line ('length of v_xml is:' || length(v_xml));
      DBMS_OUTPUT.PUT_LINE('start of this function');
      LOOP
        v_temp := SUBSTR(v_xml,   v_counter,   4000);
        EXIT
      WHEN v_temp IS NULL;
      DBMS_OUTPUT.PUT_LINE(to_char(v_temp));
      pipe ROW(v_temp);
      v_counter := v_counter + 4000;
    END LOOP;
    RETURN;
    END;
    Regards,
    Ravi Kumar

  • JDBC adapter Stored Procedure error: parameter was not supplied

    I am trying to call a Stored Procedure 'SP_FUSION_DEBMS_ADRC_MANAGE_CUSTOMER_ADDRESS' in our SQL Server database.
    XI 3.0 Sp13
    Jdbc Url: jdbc:microsoft:sqlserver://161.241.255.91:1433;databaseName=FusionDB;SelectMethod=Cursor
    I am getting following error:
    beging of error-----
    Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_FUSION_DEBMS_ADRC_MANAGE_CUSTOMER_ADDRESS' (structure 'Statement1'): java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Procedure 'SP_FUSION_DEBMS_ADRC_MANAGE_CUSTOMER_ADDRESS' expects parameter '@control_no', which was not supplied.
    End of error-----
    I have defined the field "control_no" in the interface defenition but I am not sure what causing this error, error message is mis-leading.
    Please let me know if you have any hints/comments?
    thanks,
    Laxman molugu

    Hi Laxman,
    maybe you have checked this already...from the following help link....DECIMAL might be something you might want to try out....
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm
    <i>action=EXECUTE
    Statements with this action result in a stored procedure being executed. The name of the element is interpreted as the name of the stored procedure in the database. If you use the optional <table> element, the value specified here is used as the stored procedure name. This enables you, for example, to define stored procedure names containing non-XML-compatible characters or characters that prevent them from being used in interface definitions in the Integration Builder/PCK.  If specified, <table> must be the first element in the block within <dbTableName>.
    The elements within the stored procedure are interpreted as parameters. They can optionally have the attribute isInput=“1“ (input parameter) or isOutput=“1“ (output parameter) or both (INOUT parameter). If both attributes are missing, the element is interpreted as an input parameter. The parameter names must be identical to those of the stored procedure definition.
    The attribute type=<SQL-Datatype> , which describes the valid SQL data type, is mandatory for all parameter types (IN, OUT, INOUT).
    The following SQL data types are supported:
    INTEGER, BIT, TINYINT, SMALLINT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, CHAR, VARCHAR, STRING, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, BLOB (input and output),CLOB (input and output), CURSOR (output; only in conjunction with the Oracle JDBC driver).</i>

  • MySQL Stored procedure, INOUT parameter question.

    Hello, I'm trying to run a stored procedure in MySQL 5.0 through the use of Java. Here's what I have:
    Part of my Java code (which is taken from the MySQL Connector/J documentation):
        CallableStatement cStmt = conn.prepareCall("{call demoSp(?, ?)}");                                   
        cStmt.registerOutParameter("inOutParam", Types.INTEGER);
        cStmt.setString(1, "hello");
        cStmt.setInt("inOutParam", 4);
        cStmt.execute();
        System.out.println(cStmt.getInt("inOutParam"));The stored procedure (which has been taken directly from the MySQL Connector/J documentation, PDF format, Page 4)
    CREATE PROCEDURE demoSp(IN inputParam VARCHAR(255), INOUT inOutParam INT)
    BEGIN
        DECLARE z INT;
        SET z = inOutParam + 1;
        SET inOutParam = z;
        SELECT inputParam;
        SELECT CONCAT('zyxw', inputParam);
    ENDI have tested the query in MySQL and the stored procedure does work correctly. The Java code successfuly runs the stored procedure, but the INOUT parameter always returns as 1. This behaviour indicates that when the stored procedure runs, inOutParam is set to 0, regardless of what value it is given in the Java code. Therefore, is the INOUT parameter fully supported? Maybe my Java code is incorrect?
    Thanks in advance for a response.

    I don't see anything obviously wrong with the code. That you are always getting 1 out, suggests the possibility that the input value isn't going in, is defaulting to 0 and 0+ 1 is being returned...
    As a guess, try doing:
    cStmt.setInt(2, 4);instead of:
    cStmt.setInt("inOutParam", 4);It could be that MySQL has some problems with "by name" parameters...
    Alternately, modify the stored procedure to put inOutParam into a table and see what value is being recieved...

  • Stored procedure in a transaction problem

    hello to everybody
    I have an application under weblogic8.1 sp3.
    I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
    ORA-02089: COMMIT is not allowed in a subordinate session
    Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...

    giorgio giustiniani wrote:
    hello to everybody
    I have an application under weblogic8.1 sp3.
    I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
    ORA-02089: COMMIT is not allowed in a subordinate session
    Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...It sounds like you have transactional syntax embedded in your
    procedure. You can't do that and still include it in an XA
    transaction.
    Joe

  • Reg: Need help to call a Stored Procedure - Out Parameter using DBAdapter

    HI
    I have created a procedure with Out Parameter, using DBAdapater i have invoked it. I have assigned the out parameter also. But while running i am getting this error.
    My Procedure is shown below. It executes successfully when its run in database.
    create or replace
    PROCEDURE SP_QUERY(s_string in varchar2, retCodeString out varchar2)
    AS
    l_sql_stmt varchar2(1000);
    BEGIN
    l_sql_stmt := s_string;
    EXECute immediate l_sql_stmt;
    commit;
    if SQLCODE = 0 then
    retCodeString := 'OK';
    end if;
    END;
    java.lang.Exception: oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException:
    Client received SOAP Fault from server : Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'ExecuteScript' failed due to:
    Stored procedure invocation error. Error while trying to prepare and execute the SOADEMO.SP_QUERY API.
    An error occurred while preparing and executing the SOADEMO.SP_QUERY API.
    Cause: java.sql.SQLException: ORA-06550: line 1, column 15:
    PLS-00904: insufficient privilege to access object SOADEMO.SP_QUERY ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored Check to ensure that the API is defined in the database and that the parameters match the signature of the API.
    This exception is considered not retriable, likely due to a modelling mistake.
    To classify it as retriable instead add property nonRetriableErrorCodes with value "-6550" to your deployment descriptor (i.e. weblogic-ra.xml).
    To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff.
    All properties are integers. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    at oracle.sysman.emas.model.wsmgt.WSTestModel.invokeOperation(WSTestModel.java:808) at oracle.sysman.emas.view.wsmgt.WSView.invokeOperation(WSView.java:384)
    Please help me in this issue.

    Hi
    Right now i geeting the below error
    java.lang.Exception: oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Client received SOAP Fault from server : oracle.fabric.common.FabricException:
    oracle.fabric.common.FabricInvocationException: java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist :
    java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
    at oracle.sysman.emas.model.wsmgt.WSTestModel.invokeOperation(WSTestModel.java:808) at oracle.sysman.emas.view.wsmgt.WSView.invokeOperation(WSView.java:384)
    at oracle.sysman.emas.view.wsmgt.WSView.invokeOperation(WSView.java:301) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.
    invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.el.parser.AstValue.invoke(Unknown Source)
    at com.sun.el.MethodExpressionImpl.invoke(Unknown Source) at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.
    invoke(MethodExpressionMethodBinding.java:53) at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1256)
    at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.
    run(ContextSwitchingComponent.java:92) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96) at oracle.adf.view.rich.component.fragment.
    UIXInclude.broadcast(UIXInclude.java:102) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361) at oracle.adf.view.rich.component.
    fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96) at oracle.adf.view.rich.component.fragment.UIXInclude.
    broadcast(UIXInclude.java:96) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475) at javax.faces.component.UIViewRoot.
    processApplication(UIViewRoot.java:756) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:889) at
    oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:379) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.
    execute(LifecycleImpl.java:194) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at weblogic.servlet.internal.
    StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.
    invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.sysman.emSDK.license.LicenseFilter.doFilter(LicenseFilter.java:101) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446) at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177) at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.help.web.rich.OHWFilter.doFilter(Unknown Source) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.emas.fwk.MASConnectionFilter.doFilter(MASConnectionFilter.java:41) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.eml.app.AuditServletFilter.doFilter(AuditServletFilter.java:179) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.eml.app.EMRepLoginFilter.doFilter(EMRepLoginFilter.java:203) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.core.model.targetauth.EMLangPrefFilter.doFilter(EMLangPrefFilter.java:158) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.core.app.perf.PerfFilter.doFilter(PerfFilter.java:141) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.eml.app.ContextInitFilter.doFilter(ContextInitFilter.java:542) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119) at java.security.AccessController.doPrivileged(Native Method) at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315) at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442) at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103) at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171) at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:178) Caused by: oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Client received SOAP Fault from server : oracle.fabric.common.FabricException: oracle.fabric.common.FabricInvocationException: java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist : java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist at oracle.sysman.emSDK.webservices.wsdlapi.dispatch.DispatchUtil.invoke(DispatchUtil.java:362) at oracle.sysman.emSDK.webservices.wsdlparser.OperationInfoImpl.invokeWithDispatch(OperationInfoImpl.java:1004) at oracle.sysman.emas.model.wsmgt.PortName.invokeOperation(PortName.java:750) at oracle.sysman.emas.model.wsmgt.WSTestModel.invokeOperation(WSTestModel.java:802) ... 79 more Caused by: oracle.j2ee.ws.client.jaxws.JRFSOAPFaultException: Client received SOAP Fault from server : oracle.fabric.common.FabricException: oracle.fabric.common.FabricInvocationException: java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist : java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist at oracle.j2ee.ws.client.jaxws.DispatchImpl.throwJAXWSSoapFaultException(DispatchImpl.java:1040) at oracle.j2ee.ws.client.jaxws.DispatchImpl.invoke(DispatchImpl.java:826) at oracle.j2ee.ws.client.jaxws.OracleDispatchImpl.synchronousInvocationWithRetry(OracleDispatchImpl.java:235) at oracle.j2ee.ws.client.jaxws.OracleDispatchImpl.invoke(OracleDispatchImpl.java:106) at oracle.sysman.emSDK.webservices.wsdlapi.dispatch.DispatchUtil.invoke(DispatchUtil.java:358) ... 82 more

  • Help on report base on stored Procedure with parameter in Oracle

    In Deski was able to get BO report from Stored Procedure if no parameters is required. When I tried to add a parameter to the Stored procedure does not return anything.   Your assistance is greatly appreciated.
    Here  is what I used perform the task.
    create or replace package Test_Package as
      -- Public type declarations
    TYPE Test_Type IS REF CURSOR RETURN Test_Table%ROWTYPE;
    end Test_Package;
    CREATE OR REPLACE PROCEDURE Test_Procedure(
                                test_cursor IN OUT test_package.Test_Type,
                                Test_Parameter in c2c.Test_Table.Id%type) IS
           BEGIN
                                open test_cursor for
                                select *
                                from c2c.Test_Table
                                where Test_Table.Id = Test_Parameter;
           END Test_Procedure;
    create table TEST_TABLE
      ID        NUMBER(5),
      FIRSTNAME VARCHAR2(30),
      LASTNAME  VARCHAR2(30)
    insert into Test_Table values(1,'Chen', 'Low');
    insert into Test_Table values(2,'Leonard', 'Johnson');
    insert into Test_Table values(3,'David ', 'Sucuk');
    insert into Test_Table values(4,'Marc', 'Paul');
    insert into Test_Table values(5,'Mark', 'Blasko');

    http://developer.java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html

  • Stored Procedure output to excel

    Hi Experts,
    Is it possible to get an output of a Oracle stored procedure into excel. we are executing the stored proc from SQL PLUS prompt.
    We are not using any reporting tools(no oracle reports to execute the stored proc)
    Will appreciate all the help
    Thanks

    Try like this ,
    set pages 0 term off head off feedback  off ;
    set timming off;
    SET  term off timing on feedback on
    SET  MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF
    spool  c:\test.xls
    EXEC test_proc(par1,para2);
    Print
    spool off;
    set timing on MARKUP HTML off;Thanks
    Alen

Maybe you are looking for