ORA-03115 on call Procedure with VARARRAY of STRUCT as IN and separate OUT

Hello,
I am using Oracle 11.2 and odbc6.jar of Manifest: 11.2.0.2.0 an getting the following exception
java.sql.SQLException: ORA-03115:
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:204)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1007)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3677)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4714)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1374)
The Procedure is defined as following :
CREATE OR REPLACE PROCEDURE TEST_ORACLE_PROCEDUR (
I_CLOB IN CLOB,
O_CLOB OUT CLOB,
O_CURSOR1 OUT SYS_REFCURSOR,
O_CURSOR2 OUT SYS_REFCURSOR,
I_TESTPARAM IN NESTED_KEY_VAL_PAIR,
O_TESTPARAM OUT NESTED_KEY_VAL_CLOB,
I_BLOB IN BLOB ,
O_BLOB OUT BLOB ,
I_DATE IN DATE ,
O_DATE OUT DATE ,
I_ARRAY IN ARRAY_NESTED_KEY_VAL_PAIR,
O_ARRAY OUT ARRAY_NESTED_KEY_VAL_PAIR
Currently I am working for VarArray support in our enviroment. This error did not occour when removing the both Array parameters from SP.
The type ARRAY_NESTED_KEY_VAL_PAIR is defined as follows:
1.)
ARRAY_NESTED_KEY_VAL_PAIR AS VARRAY(6) OF NESTED_KEY_VAL_PAIR;
2.)
NESTED_KEY_VAL_PAIR AS OBJECT
MyStruct KEY_VAL_PAIR_REC,
MyVarchar VARCHAR2(100)
3.)
KEY_VAL_PAIR_REC AS OBJECT (
KEY VARCHAR2(400),
VAL VARCHAR2(4000)
I am passing an array of oracle.sql.STRUCT of type NESTED_KEY_VAL_PAIR as following:
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor( typeName , connection );
new oracle.sql.ARRAY(descriptor, connection, vector.toArray() );
, where vector is the vector of STRUCT. The STRUCT Objects are created right as same as there are evaluated for I_TESTPARAM .
-> So I think there must be some driver support issue of this ARRAY of STRUCT of STRUCT .. may at IN or OUT context..
very Thanks for Help.
rgs Andre, Berlin
Edited by: user10426085 on 25.08.2011 03:36

OK here the complete definition of the procedure :
CREATE OR REPLACE PROCEDURE TEST_ORACLE_PROCEDUR (
        I_CLOB      IN      CLOB,    
        O_CLOB         OUT  CLOB,
        O_CURSOR1      OUT  SYS_REFCURSOR,
        O_CURSOR2      OUT  SYS_REFCURSOR,
        I_TESTPARAM IN      NESTED_KEY_VAL_PAIR,
        O_TESTPARAM    OUT  NESTED_KEY_VAL_CLOB,
        I_BLOB      IN      BLOB ,
        O_BLOB         OUT  BLOB ,
        I_DATE      IN      DATE ,
        O_DATE         OUT  DATE ,
        I_ARRAY     IN      ARRAY_NESTED_KEY_VAL_PAIR,
        O_ARRAY        OUT  ARRAY_NESTED_KEY_VAL_PAIR               
) IS
BEGIN
   BEGIN
         /* Test IN CLOB, IN UserDefindedType , IN BLOB */
              INSERT INTO TEST_ORACLE_PROCEDUR_TABLE (CLOBTEST,USERTYPETEST, BLOBTEST , DATETEST , ARRAYTEST ) VALUES( I_CLOB , I_TESTPARAM , I_BLOB , I_DATE , I_ARRAY );                                           
              COMMIT;  
         /* Test OUT CLOB by IN CLOB-Value */
              SELECT CLOBTEST     into O_CLOB       FROM  TEST_ORACLE_PROCEDUR_TABLE;      
         /* Test OUT BLOB by IN BLOB-Value */
              SELECT BLOBTEST     into O_BLOB       FROM  TEST_ORACLE_PROCEDUR_TABLE;      
         /* Test OUT DATE by IN DATE-Value */
              SELECT DATETEST     into O_DATE       FROM  TEST_ORACLE_PROCEDUR_TABLE;       
         /* Test OUT userdefined Type by self constructed object */
              O_TESTPARAM := NESTED_KEY_VAL_CLOB( KEY_VAL_PAIR_REC( 'myKey_1' , 'myValue_1' ) , 'myVarcharValue' , O_CLOB );
         /* Test OUT ARRAY Type */
              SELECT ARRAYTEST    into O_ARRAY      FROM  TEST_ORACLE_PROCEDUR_TABLE;       
         /* Test Out Cursor    */
              OPEN O_CURSOR1 FOR  SELECT DUMMY FROM  DUAL;
              OPEN O_CURSOR2 FOR  SELECT CLOBTEST,USERTYPETEST, BLOBTEST, DATETEST , ARRAYTEST  FROM  TEST_ORACLE_PROCEDUR_TABLE;                   
    /* return */                                                                                                                                        
         RETURN;
   EXCEPTION
     WHEN OTHERS THEN
         raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
   END;
END;

Similar Messages

  • Call procedure with named parameters

    Call procedure with positional parameters works, but with named parameters gives an ORA-907.
    This post seems similar: Re: Error with report - pkg and bind var
    Run as a script:
    set echo on
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false);
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS');
    begin dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false); end;
    gives:
    set echo on
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false)
    Error starting at line 2 in command:
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false)
    Error report:
    SQL Error: ORA-00907: missing right parenthesis
    00907. 00000 - "missing right parenthesis"
    *Cause:
    *Action:
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS')
    call dbms_stats.delete_table_stats succeeded.
    begin dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false); end;
    anonymous block completed
    I like the idea of using call, because the procedure name appears in the feedback - useful in longer scripts.
    I'm using SQL Developer Version 1.5.1 Build MAIN-5440
    on Windows XP SP3
    with database EE 10.2.0.3

    CALL is a SQL command which executes a routine
    (procedure/function)
    http://download-uk.oracle.com/docs/cd/B19306_01/server
    .102/b14200/statements_4008.htm
    whereas EXECUTE is a SQL*Plus command which executes
    a single PL/SQL statement
    http://download-uk.oracle.com/docs/cd/B19306_01/server
    .102/b14357/ch12022.htm#i2697931
    Message was edited by:
    Jens PetersenThank you very much, esp. for the links!

  • HT4245 facetime for mac I can hear caller but my mike is locked on mute and grayed out

    facetime for mac I can hear caller but my mike is locked on mute and grayed out.  I am on mountain lion 10.8

    Double-click the Home button to display recently used apps.
    Flick from left to right along the bottom of the screen.
    Tap the Mute button on the bottom left of the screen.
    A slash will appear across the Mute button:

  • ORA-03115 Error using CLOB with JDBC

    When I try to access CLOB field data with JDBC driver, I gets following error:
    ORA-03115: unsupported network datatype or representation.
    I am using JDBC 8.1.6(Thin), Oracle 8.0.5
    on Linux OS.
    what's the problem ?
    Thank you for any help.
    Taesoo.
    null

    if it is a bug, then its better to upgrade the database to 10.2.0.4. it is the stable verion in 10g.

  • Call procedure with MS SQL from linked Oracle server

    I have a procedure on a remote server that I can call from SQL*PLUS
    set serveroutput on
    declare rez varchar2(99); msg varchar2(99); begin radar.test('AL25',rez,msg); dbms_output.put_line('Rez='||rez);
    dbms_output.put_line('Msg='||msg);
    end;
    it gives me the neccessary result.
    But I need to call the same procedure with MS SQL from a linked Oracle server, I'm trying to do it through openquery for a while, but no success yet.
    Can someone tell me what is the right syntax for that query in OPENQUERY?

    Have you tried configuring Oracle Heterogenous Services/ Transparent Gateway? This would let you link Oracle to SQL Server via a database link which should solve your problem.
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com

  • How to call procedure with Object types in java

    Hi,
    We have procedure declaration as follows
    ===============
    TYPE TEST_TYPE AS OBJECT (NAME VARCHAR2(10));
    TYPE TESTTYPE1 AS object (student1 TESTTYPE,student2 TESTTYPE,student3 TESTTYPE);
    TYPE rect AS OBJECT
    -- The type has 3 attributes.
    length NUMBER,
    width NUMBER,
    area NUMBER,
    -- Define a constructor that has only 2 parameters.
    CONSTRUCTOR FUNCTION rect(length NUMBER, width NUMBER)
    RETURN SELF AS RESULT
    PROCEDURE G(obj1 in TESTTYPE1,obj2 out rect) as
    n1 testtype;
    n2 testtype;
    n3 testtype;
    n4 testtype;
    begin
    obj2 := NEW rect(10,20,200);
    n1 := obj1.student1;
    n2 := obj1.student2;
    n3 := obj1.student3;
    obj2.length :=20;
    end;
    =====================================================
    I am not able to call the procedure in java code as I cannot figure out which out parameter type will it be registered using registeroutparameter. using cursor or struct type fails.
    please let me know how I can pass values from stored procedure with objects to java.

    I'm not sure what you're trying to accomplish with your procedure, but in general, this is an example of how you could use oracle.sql.STRUCT.
    First, prepare your java.sql.CallableStatement using java.sql.CallableStatement cStmt = java.sql.Connection.prepareCall({ call G(?, ?) });
    Note that you don't have to use the OracleCallableStatement. The java.sql.CallableStatement will work just fine.
    For the IN parameter, you need to create three TEST_TYPE objects. Then you need to create one TESTTYPE1 object.
    These will all be instances of oracle.sql.STRUCT.
    To create a oracle.sql.STRUCT object you need a descriptor and a set of attributes. For example, to create a TEST_TYPE object you would do the following
    1. StructDescriptor sd = StructDescriptor.createDescriptor("TEST_TYPE", java.sql.Connection).
    2. Add a VARCHAR2 attribute to an array of attributes (e.g. Object[] attributes = new Object[]{"Student Name"})
    3. oracle.sql.STRUCT struct = new oracle.sql.STRUCT(sd, java.sql.Connection, attributes)
    Then do something similar to create the TESTTYPE1 object, except that the attribute array will contain three instances of TEST_TYPE struct objects.
    To bind the IN parameter you need to use the java.sql.CallableStatement.setObject(1, <Instance of TESTTYPE1 object>).
    To register the OUT parameter, you need to call java.sql.CallableStatement.registerOutParameter(2, oracle.jdbc.OracleTypes.STRUCT, "RECT").
    Then, execute your procedure using cStmt.execute();
    Retrieve your OUT parameter using oracle.sql.STRUCT struct = (oracle.sql.STRUCT)cStmt.getObject(2).
    Once you've done that, to get the values of the attributes of all of your STRUCT objects, you need their descriptors and their metadata.

  • Problem calling Procedure with parameter from Dynamic Page

    I received an error saying the Page not found
    here's how to reproduce the error.
    1. Create procedure in portal30 schema.
    Create or Replace PROCEDURE PORTAL30.ADD_TWO_VALUES
    v_one IN NUMBER,
    v_two IN NUMBER,
    v_result OUT NUMBER)
    as
    begin
    v_result :=v_one+v_two;
    end;
    2. Create Dynamic Page with following code
    <ORACLE>DECLARE
    v_total NUMBER;
    BEGIN
    ADD_TWO_VALUES(:v_one,:v_two, v_total);
    htp.p('The total is => ');
    htp.p('<input type="TEXT" VALUE='||v_total||'>');
    htp.para;
    htp.anchor('http://<machine.domain:port#>/pls/portal30/PORTAL30.DYN_
    ADD_TWO_VALUES.show_parms', 'Re-Execute Procedure');
    END;</ORACLE>
    3. I clicked on Customize Link and entered 2 numbers as values for v_one and v_two.
    4. Got "The page cannot be found" error in I.E. or "The requested URL /pls/portal30/PORTAL30.DYN_SAMPLE_ADD.show was not found on this server." on Netscape
    However when I subsitute "ADD_TWO_VALUES(:v_one,:v_two, v_total);" in the dynamic page for "ADD_TWO_VALUES(3,2, v_total);", it runs just fine.
    What's wrong here? Can I not use a parameter from a dynamic page and call a procedure with it? Help is needed urgently and will be greatly appreciated.
    -Ahsun

    Hi,
    I tried with your code with few changes ,please try with them.
    Create or Replace PROCEDURE <myschema>.ADD_TWO_VALUES
    v_one IN NUMBER,
    v_two IN NUMBER,
    v_result OUT NUMBER)
    as
    begin
    v_result :=v_one+v_two;
    end;
    I created the procedure in <mySchema> and granted that to <application_schema> and made some changes
    <ORACLE>
    DECLARE
    v_total NUMBER;
    BEGIN
    <procedure_schema>.ADD_TWO_VALUES(:v_one,:v_two, v_total);
    htp.p('The total is => ');
    htp.p('<input type="TEXT" VALUE='||v_total||'>');
    htp.para;
    htp.anchor('http://<your_host>/pls/<portal_schema>/<application_schema>.DYN_FOR_OTN.SHOW_PARMS', 'Re-Execute Procedure');
    END;
    </ORACLE>
    Hope this helps.
    rahul

  • Calling a stored procedure with a table of custom types as a out parameter

    Hi,
    I'm trying to use toplink 11.1.1.0.0 to call a stored procudure with 4 in paramrs and a single out parameter of type gsearch_type which is a userdefined type defined as below
    CREATE or replace TYPE search_object as object (mdlnumber varchar2(12), hit clob);
    create or replace type gsearch_type as table of search_object;
    Is it possible to get the return value from this stored procedure using toplink.
    Thanks in advance for any help.
    - Sunil

    Currently TopLink can't directly handle that kind of output parameter.
    As a workaround you would need a wrapper for the stored procedure - it could be either another stored procedure or an anonymous block which would return the components of the complex parameter as several simple parameters.

  • Calling procedure with 2 parameters from a dynamic link

    I have just another question-
    I have a procedure testing_del_archive which is being called with 2 parameters...from a dynamic link in my SQL Query.
    The following is my code....
    SELECT re.report_exec_id, re.exec_userid,
    NVL(re.batch_exec_date, re.begin_date) report_date,
    re.rows_returned,
    re.status, re.error,
    f_file_url(re.filename) file_url,
    re.comments,
    ''Archive''archive
    FROM metadev.report_execution re, metadev.report r
    WHERE re.report_id = r.report_id
    AND r.spec_number = :v_spec
    AND re.status <> 'DELETED'
    AND re.exec_userid like (DECODE(:v_user_filter,'ALL','%',:v_user_filter))
    ORDER BY begin_date DESC
    The first parameter is the value in the execution id field and the second argument is hardcoded "Archived"...
    IT GIVES AN ERROR....
    Do you guys know where I am going wrong...

    You missed the ampersand symbol in between the parameters.
    This should be
    ''Archive''archive
    instead of
    ''Archive''archive

  • Calling procedure with 4 output varchar2 gets corrupted (via SQLExecDirect)

    I have a procedure:
    create or replace procedure
    cme.GetNominalIndividualDetails(iNominalIndexID in
    number,sSurname out varchar2,sForenames out varchar2,sCRONumber
    out varchar2,dtDOB out date) AS
    begin
    select Surname,Forenames,CRONumber,DOB into
    sSurname,sForenames,sCRONumber,dtDOB from v_NominalIndividual
    where NominalIndexID = iNominalIndexID;
    exception
    when no_data_found then
    begin
    sSurname:=null;
    sForenames:=null;
    dtDOB:=null;
    sCRONumber:=null;
    end;
    end;
    When I call this procedure from code I always get corrupt
    strings comming back (it looks like they are not null
    terminated) using ODBC with VC++ using Bindparameters with
    SQLExecDirect.
    The latest odbc driver is no help..
    If anyone has a solution please let me know... (it works fine
    with our Sybase / MS SQL server databases).
    I am persuming it is a bug in the oracle odbc ??
    Matt.
    Can you email at [email protected]
    Thanks.

    fyi
    Related to the solution/workaround posted by Luc.
    see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
    at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
    regards
    Jan Vervecken

  • Calling procedure with user defined IN & OUT parameters

    I have procedure in a package which I need to call from the JDBC. My problem is, that procedure take user-defined data types as IN parameters & gives user-defined OUT paramters. How do I call a procedure like this. Do I need to write the wrapper class. If so from where do I start, I mean I don't have any idea about writing wrapper classes. Below is the package spec which might help you uderstand my question more clearly.
    CREATE OR REPLACE PACKAGE FAM_AR_SUMMARY_PKG IS
    TYPE ar_summ_rec_type IS RECORD (
    CUST_NAME hz_parties.party_name%TYPE,
    CUST_ACCT_NO hz_cust_accounts_all.ACCOUNT_NUMBER%TYPE,
    CUST_ACCT_BAL NUMBER,
    CUST_PAST_DUE_BAL NUMBER,
    CUST_UNAPP_REC_BAL NUMBER,
    CONTRACT_NO okc_k_headers_b.CONTRACT_NUMBER%TYPE,
    ANN_DATE okc_k_headers_b.END_DATE%TYPE,
    TOT_CONTRACT_VALUE okc_k_headers_b.ESTIMATED_AMOUNT%TYPE,
    PAST_DUE_AMT NUMBER,
    DAYS_PAST_DUE NUMBER,
    INV_PAST_DUE NUMBER,
    DEP_INV_BAL NUMBER,
    AMT_CREDITED NUMBER);
    TYPE ar_summ_tbl_type IS TABLE OF ar_summ_rec_type
    INDEX BY BINARY_INTEGER;
    PROCEDURE FAM_GET_AR_SUMMARY(p_cust_name IN hz_parties.party_name%TYPE,
    p_chr_id IN okc_k_headers_b.ID%TYPE,
    x_ar_summ_tbl OUT NOCOPY ar_summ_tbl_type,
    x_excp_message OUT VARCHAR2);
    END FAM_AR_SUMMARY_PKG;

    Hi,
    U cant get the type record from the DB with java. I hope u r using oracle. Instead u can create a Type object and then make it as an OUT parameter. Try reading the oracle documentation for it (JDBC Developer's Guide and Reference).
    Regards,
    Chandru.M

  • Call procedure with return cursor

    Dear All,
    there is a cast with my job. i have procedure like below:
    CREATE OR REPLACE PROCEDURE ISISALL.P_TEST (PARAM1 IN VARCHAR2,RETURN_TABLE OUT SYS_REFCURSOR) IS
    BEGIN
    OPEN RETURN_TABLE FOR
    SELECT FIELD2,FIELD3 FROM MYTABLE
    WHERE FIELD1=PARAM1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    -- Consider logging the error and then re-raise
    RAISE;
    END P_TEST;
    my question, How to call the procedure ? i want insert table with source from the procedure (P_TEST)..

    >
    How to call the procedure ? i want insert table with source from the procedure (P_TEST)..
    >
    This code sample that you can test in the SCOTT schema should give you enough information
    CREATE OR REPLACE TYPE SCOTT.local_type IS OBJECT (
        empno   NUMBER(4),
        ename   VARCHAR2(10));
    CREATE OR REPLACE TYPE SCOTT.local_tab_type IS TABLE OF local_type;
    CREATE OR REPLACE PACKAGE SCOTT.test_refcursor_pkg
    AS
        TYPE my_ref_cursor IS REF CURSOR;
         -- add more cursors as OUT parameters
         PROCEDURE   test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor);
    END test_refcursor_pkg;
    CREATE OR REPLACE PACKAGE BODY SCOTT.test_refcursor_pkg
    AS
         PROCEDURE  test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor)
         AS
            l_recs local_tab_type;
         BEGIN
             -- Get the records to modify individually.
             SELECT local_type(empno, ename) BULK COLLECT INTO l_recs
             FROM EMP;
             -- Perform some complex calculation for each row.
             FOR i IN l_recs.FIRST .. l_recs.LAST
             LOOP
                 DBMS_OUTPUT.PUT_LINE(l_recs(i).ename);
             END LOOP;
             -- Put the modified records back into the ref cursor for output.  
             OPEN p_ref_cur_out FOR
             SELECT * from TABLE(l_recs);      
             -- open more ref cursors here before returning
         END test_proc;
    END;
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
      l_cursor  test_refcursor_pkg.my_ref_cursor;
      l_ename   emp.ename%TYPE;
      l_empno   emp.empno%TYPE;
    BEGIN
      test_refcursor_pkg.test_proc (l_cursor);
      LOOP
        FETCH l_cursor
        INTO  l_empno, l_ename;
        EXIT WHEN l_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(l_ename || ' | ' || l_empno);
      END LOOP;
      CLOSE l_cursor;
    END;
    /Are you sure you wouldn't be better off using a PIPELINED function instead? Then you can just select from it as if it were a table and do whatever you want with the data
    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    -- pipelined function
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
    select * from table(get_emp(20))

  • Call procedure with Spring and strange invalid index error.

    Hi I call a procedure, from java in this way:
    FlussiGiornalieriStoredProcedure proc = new FlussiGiornalieriStoredProcedure(dataSource);
                   String column_order="";
                   if (orderColumn!=null) {
                        column_order = orderColumn + " " + orderType;
                   } else {
                        column_order = " stato DESC "; //this is the invalid index column of the error               
    Map mappa = proc.execute(idGruppo, dataInizio, dataFine, startRow, endRow, column_order);
                   result = (List<VistaFlussiGiornalieri>) mappa.get("recordsetCursor");
                   numeroTotaleRighe = ((BigDecimal)mappa.get("countRow")).intValue();
    response.setSize(numeroTotaleRighe);
              response.setList((List<VistaFlussiGiornalieri>) result);
    private class FlussiGiornalieriStoredProcedure extends StoredProcedure {
            private static final String SQL = "mkt_flussi_giornalieri2";
            public FlussiGiornalieriStoredProcedure(DataSource ds) {             
                super(ds, SQL);
                declareParameter(new SqlParameter("idGruppo", Types.VARCHAR));
                declareParameter(new SqlParameter("dataInizio", Types.DATE));
                declareParameter(new SqlParameter("dataFine", Types.DATE));           
                declareParameter(new SqlParameter("startRow", OracleTypes.NUMBER));
                declareParameter(new SqlParameter("endRow", OracleTypes.NUMBER));
                declareParameter(new SqlParameter("column_order", OracleTypes.VARCHAR));
                //declareParameter(new SqlParameter("order_name", OracleTypes.VARCHAR));
                declareParameter(new SqlOutParameter("recordsetCursor", OracleTypes.CURSOR, VistaFlussiGiornalieriDaoImpl.this));
                declareParameter(new SqlOutParameter("countRow", OracleTypes.NUMBER, VistaFlussiGiornalieriDaoImpl.this));
                //declareParameter(new SqlOutParameter("QUERY_STM", OracleTypes.VARCHAR, VistaFlussiGiornalieriDaoImpl.this));
                compile();
            public Map execute(String idGruppo, Date dataInizio, Date dataFine, int startRow, int endRow, String column_order) {
                 Map inputs = new HashMap();
                 inputs.put("idGruppo", idGruppo);
                 inputs.put("dataInizio", dataInizio);
                 inputs.put("dataFine", dataFine);
                 inputs.put("startRow", startRow);
                 inputs.put("endRow", endRow);
                 inputs.put("column_order", column_order);
                return execute(inputs);
        }When The java class call the oracle procedure I receive this message:
    >
    Caused by: java.sql.SQLException: Invalid index column
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
         at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:385)
         at it.edison.markettracker.dao.spring.VistaFlussiGiornalieriDaoImpl.mapRow(VistaFlussiGiornalieriDaoImpl.java:155)
         at it.edison.markettracker.dao.spring.VistaFlussiGiornalieriDaoImpl.mapRow(VistaFlussiGiornalieriDaoImpl.java:1)
         at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:92)
         at org.springframework.jdbc.core.JdbcTemplate.processResultSet(JdbcTemplate.java:1124)
         at org.springframework.jdbc.core.JdbcTemplate.extractOutputParameters(JdbcTemplate.java:1085)
         at org.springframework.jdbc.core.JdbcTemplate$5.doInCallableStatement(JdbcTemplate.java:997)
         at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:936)
         ... 26 more
    If I call the procedure, from toad, in this way:
    SET serveroutput ON
    DECLARE
    TROVATI SYS_REFCURSOR;
    NUMERO_TROVATI NUMBER;
    BEGIN
          DBMS_OUTPUT.ENABLE(30000);
          dbms_output.put_line('INIZIO');
          Mkt_Flussi_Giornalieri2(1, trunc(sysdate), trunc(sysdate), 100, 50, 'stato DESC', TROVATI, NUMERO_TROVATI);
          dbms_output.put_line('RECORD TROVATI:'||NUMERO_TROVATI);
    END; I don't receive any error message. Why?
    The procedure is:
    CREATE OR REPLACE PROCEDURE Mkt_Flussi_Giornalieri2
    ( idGruppo IN VARCHAR2
    , dataInizio IN DATE
    , dataFine IN DATE
    , startRow IN NUMBER
    , endRow IN NUMBER
    , column_order in varchar2
    --, order_name in varchar2
    , recordsetCursor OUT SYS_REFCURSOR
    , countRow OUT NUMBER
    ) IS
    order_clause varchar2(200) := ' ';
    sql_stm varchar2(32000);
    BEGIN
    IF column_order IS NOT NULL
    THEN
    order_clause := column_order;
    ELSE
    order_clause := ' stato DESC ';
    END IF;
    dbms_output.put_line('clausola:'||order_clause);
    sql_stm:='
         SELECT idflusso, descrizioneFlusso, dataRiferimento, strDataRiferimento,
            stato,  dataElaborazione, ultimoMessaggio, livello, utentiRiferimento,
            exec_seq, provider_description, log_info FROM
      (SELECT idflusso, descrizioneFlusso, dataRiferimento, strDataRiferimento,
            stato,  dataElaborazione, ultimoMessaggio, livello, utentiRiferimento,
            exec_seq, provider_description, log_info FROM
      (SELECT
    temp.flow_id AS idFlusso,
    MKT_FLOW.flow_id || '' - '' || MKT_FLOW.flow_description || ''('' || temp.exec_seq || '')'' AS descrizioneFlusso,
    TO_DATE(temp.date_id,''yyyymmddhh24miss'') AS dataRiferimento,
    TO_CHAR(TO_DATE(temp.date_id,''yyyymmddhh24miss''),''dd/mm/yyyy'')||'' h. ''||TO_CHAR(TO_DATE(temp.date_id,''yyyymmddhh24miss''),''hh24:mi'') AS strDataRiferimento,
    temp.status AS stato, temp.end_time AS dataElaborazione, DECODE(temp.status,3, ERROR_DESC, 1, TRACE_DES) AS ultimoMessaggio,
    DECODE(temp.status,3, error_level, 1, fk_trace_level) AS livello,
    Get_Group_Description(MKT_FLOW.flow_id) AS utentiRiferimento, temp.exec_seq AS exec_seq, mp.provider_description,
                             mp.provider_link, mfc.log_info
    FROM (
      SELECT v.*, tr.TRACE_ID, tr.TRACE_DES , tr.trace_date, tr.fk_trace_level, e.ERROR_ID, e.ERROR_CODE, NVL(e.ERROR_DESC, er.ERROR_DESC) AS ERROR_DESC, e.error_date, e.error_level,
      MIN(e.error_id) OVER (PARTITION BY e.fk_exec_seq) eid,
      MAX(tr.trace_id) OVER (PARTITION BY tr.fk_exec_seq) tid
      FROM (
        SELECT fc.*, MAX(exec_seq) OVER (PARTITION BY flow_id, flow_frequency, n_run, date_id) exsq
        FROM mkt_flow_conf_view fc
        WHERE TRUNC(end_time) >= :1
          AND TRUNC(end_time) <= :2
      ) v, MKT_ERROR er, MKT_FLOW_ERROR e, MKT_FLOW_TRC tr
      WHERE v.exec_seq        = v.exsq
        AND e.fk_exec_seq (+) = v.exec_seq
        AND tr.fk_exec_seq (+) = v.exec_seq
        AND er.error_id (+) = e.error_code
    ) temp
    INNER JOIN MKT_FLOW
    ON MKT_FLOW.flow_id = temp.flow_id AND MKT_FLOW.n_run = temp.n_run AND MKT_FLOW.flow_frequency = temp.flow_frequency
    INNER JOIN MKT_FLOW_GROUP ON MKT_FLOW_GROUP.flow_id = MKT_FLOW.flow_id
    LEFT OUTER JOIN
                             (SELECT DISTINCT flow_id, log_info
                                         FROM mkt_flow_conf) mfc
                             ON mkt_flow.flow_id = mfc.flow_id
                             , mkt_provider mp
    WHERE NVL(error_id, -1) = NVL(eid, -1)
      AND NVL(trace_id, -1) = NVL(tid, -1)
      AND MKT_FLOW_GROUP.group_id=:3
      AND NVL (mkt_flow.fk_provider_id, '' '') =
                                                         NVL (mp.provider_id, '' '') )
      WHERE ROWNUM <= :4
      MINUS
      (SELECT idflusso, descrizioneFlusso, dataRiferimento, strDataRiferimento,
            stato,  dataElaborazione, ultimoMessaggio, livello, utentiRiferimento,
            exec_seq, provider_description, log_info FROM
      (SELECT
    temp.flow_id AS idFlusso,
    MKT_FLOW.flow_id || '' - '' || MKT_FLOW.flow_description || ''('' || temp.exec_seq || '')'' AS descrizioneFlusso,
    TO_DATE(temp.date_id,''yyyymmddhh24miss'') AS dataRiferimento,
    TO_CHAR(TO_DATE(temp.date_id,''yyyymmddhh24miss''),''dd/mm/yyyy'')||'' h. ''||TO_CHAR(TO_DATE(temp.date_id,''yyyymmddhh24miss''),''hh24:mi'') AS strDataRiferimento,
    temp.status AS stato, temp.end_time AS dataElaborazione, DECODE(temp.status,3, ERROR_DESC, 1, TRACE_DES) AS ultimoMessaggio,
    DECODE(temp.status,3, error_level, 1, fk_trace_level) AS livello,
    Get_Group_Description(MKT_FLOW.flow_id) AS utentiRiferimento, temp.exec_seq AS exec_seq, mp.provider_description,
                             mp.provider_link, mfc.log_info
    FROM (
      SELECT v.*, tr.TRACE_ID, tr.TRACE_DES , tr.trace_date, tr.fk_trace_level, e.ERROR_ID, e.ERROR_CODE, NVL(e.ERROR_DESC, er.ERROR_DESC) AS ERROR_DESC, e.error_date, e.error_level,
      MIN(e.error_id) OVER (PARTITION BY e.fk_exec_seq) eid,
      MAX(tr.trace_id) OVER (PARTITION BY tr.fk_exec_seq) tid
      FROM (
        SELECT fc.*, MAX(exec_seq) OVER (PARTITION BY flow_id, flow_frequency, n_run, date_id) exsq
        FROM mkt_flow_conf_view fc
        WHERE TRUNC(end_time) >= :5
          AND TRUNC(end_time) <= :6
      ) v, MKT_ERROR er, MKT_FLOW_ERROR e, MKT_FLOW_TRC tr
      WHERE v.exec_seq        = v.exsq
        AND e.fk_exec_seq (+) = v.exec_seq
        AND tr.fk_exec_seq (+) = v.exec_seq
        AND er.error_id (+) = e.error_code
    ) temp
    INNER JOIN MKT_FLOW
    ON MKT_FLOW.flow_id = temp.flow_id AND MKT_FLOW.n_run = temp.n_run AND MKT_FLOW.flow_frequency = temp.flow_frequency
    INNER JOIN MKT_FLOW_GROUP ON MKT_FLOW_GROUP.flow_id = MKT_FLOW.flow_id
    LEFT OUTER JOIN
                             (SELECT DISTINCT flow_id, log_info
                                         FROM mkt_flow_conf) mfc
                             ON mkt_flow.flow_id = mfc.flow_id
                             , mkt_provider mp
    WHERE NVL(error_id, -1) = NVL(eid, -1)
      AND NVL(trace_id, -1) = NVL(tid, -1)
      AND MKT_FLOW_GROUP.group_id=:7
      AND NVL (mkt_flow.fk_provider_id, '' '') =
                                                         NVL (mp.provider_id, '' '') )
      WHERE ROWNUM <= :8
      )  ) ORDER BY :9' ;
    dbms_output.enable(30000);
    dbms_output.put_line(sql_stm);
    OPEN recordsetCursor FOR sql_stm USING dataInizio, dataFine, idGruppo, endRow, dataInizio, dataFine, idGruppo, startRow, order_clause;
       SELECT COUNT(*) INTO countRow FROM
      (SELECT
    temp.flow_id AS idFlusso,
    MKT_FLOW.flow_id || ' - ' || MKT_FLOW.flow_description || '(' || temp.exec_seq || ')' AS descrizioneFlusso,
    TO_DATE(temp.date_id,'yyyymmddhh24miss') AS dataRiferimento,
    TO_CHAR(TO_DATE(temp.date_id,'yyyymmddhh24miss'),'dd/mm/yyyy')||' h. '||TO_CHAR(TO_DATE(temp.date_id,'yyyymmddhh24miss'),'hh24:mi') AS strDataRiferimento,
    temp.status AS stato, temp.end_time AS dataElaborazione, DECODE(temp.status,3, ERROR_DESC, 1, TRACE_DES) AS ultimoMessaggio,
    DECODE(temp.status,3, error_level, 1, fk_trace_level) AS livello,
    Get_Group_Description(MKT_FLOW.flow_id) AS utentiRiferimento, temp.exec_seq AS exec_seq, mp.provider_description,
                             mp.provider_link, mfc.log_info
    FROM (
      SELECT v.*, tr.TRACE_ID, tr.TRACE_DES , tr.trace_date, tr.fk_trace_level, e.ERROR_ID, e.ERROR_CODE, NVL(e.ERROR_DESC, er.ERROR_DESC) AS ERROR_DESC, e.error_date, e.error_level,
      MIN(e.error_id) OVER (PARTITION BY e.fk_exec_seq) eid,
      MAX(tr.trace_id) OVER (PARTITION BY tr.fk_exec_seq) tid
      FROM (
        SELECT fc.*, MAX(exec_seq) OVER (PARTITION BY flow_id, flow_frequency, n_run, date_id) exsq
        FROM mkt_flow_conf_view fc
        WHERE TRUNC(end_time) >= dataInizio
          AND TRUNC(end_time) <= dataFine
      ) v, MKT_ERROR er, MKT_FLOW_ERROR e, MKT_FLOW_TRC tr
      WHERE v.exec_seq        = v.exsq
        AND e.fk_exec_seq (+) = v.exec_seq
        AND tr.fk_exec_seq (+) = v.exec_seq
        AND er.error_id (+) = e.error_code
    ) temp
    INNER JOIN MKT_FLOW
    ON MKT_FLOW.flow_id = temp.flow_id AND MKT_FLOW.n_run = temp.n_run AND MKT_FLOW.flow_frequency = temp.flow_frequency
    INNER JOIN MKT_FLOW_GROUP ON MKT_FLOW_GROUP.flow_id = MKT_FLOW.flow_id
    LEFT OUTER JOIN
                             (SELECT DISTINCT flow_id, log_info
                                         FROM mkt_flow_conf) mfc
                             ON mkt_flow.flow_id = mfc.flow_id
                             , mkt_provider mp
    WHERE NVL(error_id, -1) = NVL(eid, -1)
      AND NVL(trace_id, -1) = NVL(tid, -1)
      AND MKT_FLOW_GROUP.group_id=idGruppo
      AND NVL (mkt_flow.fk_provider_id, ' ') =
                                                         NVL (mp.provider_id, ' '));
    END Mkt_Flussi_Giornalieri2;
    /Please, could someone help me?
    Thanks. Bye Bye.

    Hi,
    I have solved the problem, I forgot a parameter in the select, so java tells the an error. But now I have another problem. The procedure doesn't execute the order by. I pass the couple column_name order_type in a string as ("provider_description desc") dinamically but the procedure doesn't execute the ordering. Why?
    Thanks, bye bye.

  • Call Oracle procedure with custom data type within Java and Hibernate

    I have a custom date TYPE in Oracle
    like
    CREATE TYPE DATEARRAY AS TABLE OF DATE;
    and I have a Oracle function also
    like
    CREATE OR REPLACE FUNCTION doesContain (list DATEARRAY, val VARCHAR2) RETURN NUMBER
    IS
    END doesContain;
    In my Java class,
    I have a collection which contain a list of java.util.Date objects
    When I call Oracle function "doesContain", how to pass my java collection to this Oracle function ...
    anyone can provide solutions?
    Please !!!
    Thanks,
    Pulikkottil

    Vu,
    First of all you need to define your types as database types, for example:
    create or replace type T_ID as table of number(5)Then you need to use the "oracle.sql.ARRAY" class. You can search this forum's archives for the term "ARRAY" in order to find more details and you can also find some samples via the JDBC Web page at the OTN Web site.
    Good Luck,
    Avi.

  • Call Procedure with OUT Parameter

    Hi,
    When I use an Procedure that has an OUT Parameter
    how can I use these OUT Parameter as an IN Parameter for an another Procedure.
    thanks
    Marcel

    Not sure, but is the following you after,
    SQL> create or replace procedure p1_out (a out number)
      2  as
      3  begin
      4  a := 10;
      5  end;
      6  /
    Procedure created.
    SQL> create or replace procedure p1_in (a in number)
      2  as
      3  begin
      4  dbms_output.put_line(a);
      5  end;
      6  /
    Procedure created.
    SQL> declare
      2  a number;
      3  begin
      4  p1_out(a);
      5  p1_in(a);
      6  end;
      7  /
    10
    PL/SQL procedure successfully completed.
    SQL>

Maybe you are looking for