OCCI call PL/SQL Procedure with 2 IN/OUT Parameters..BUS ERROR!!

Hi~ All,
I am new user for using OCCI. Util now, I encountered a problem with OCCI when I call a procedure with 2 IN/OUT parameters. Then,I got an error(core dump), Why?
CREATE OR REPLACE PROCEDURE demo_proc (v1 in integer, v2 in out varchar2, v3 in out varchar2);
==== OCCI Code ========
stmt = conn->createStatement
("BEGIN demo_proc(:v1, :v2, :v3); END;");
cout << "Executing the block :" << stmt->getSQL() << endl;
stmt->setInt (1, 10);
stmt->setString (2, "Test1");
stmt->setString (3, "First");
int updateCount = stmt->executeUpdate ();
cout << "Update Count:" << updateCount << endl;
cout << "Printing the INOUT & OUT parameters:" << endl;
string c1 = stmt->getString (2);
cout << c1 << endl;
string c2 = stmt->getString (3);
==== RUN RESULT ====
Bus error(coredump)
But, If i just only got one of string from v1 or v2,I could get correct result!! Why? Does some one know how to avoid this two IN/OUT parameters issue?

Hi~ Amoghavarsha,
Thanks for your response! I solved the problem by myself. I found the root cause, it seems very strange in
initializing environment variable.
=== FAILED ===
Environment *env;
=== SUCCESS ===
Environment *env = NULL; <---Why??
cout << "occidml - createEnvironment" << endl;
env = Environment::createEnvironment (Environment::OBJECT);
Eventually, I fixed this issue in Win2K and HP-UX 11.
Best Regards,

Similar Messages

  • Problem with database adapter on plsql procedure with in/out parameters

    running BPEL 10.1.3.1 and using the database adapter on a plsql procedure with in/out parameters I get errors
    the plsql procedure:
    create or replace procedure proc_with_clob_inout_parameter(
    p_string in varchar2,
    p_clob in out clob)
    is
    begin
    p_clob := p_string;
    end proc_with_clob_inout_parameter;
    In BPEL I call this procedure. When I only assign a value to the p_string parameters (in a BPEL assign) all is well. When I also assign a value to the p_clob parameter the error occurs:
    <part name="summary">
    <summary>
    file:/ora1/app/oracle/as101.3/bpel/domains/digitaaldossier/tmp/.bpel_janb_inout_1.0_f6908ccf864581b7265c362444e88075.tmp/twee.wsdl
    [ twee_ptt::twee(InputParameters,OutputParameters) ] - WSIF JCA Execute of
    operation 'twee' failed due to: Error while trying to prepare and execute
    an API.
    An error occurred while preparing and executing the
    JANB.PROC_WITH_CLOB_PARAMETER2 API. Cause: java.sql.SQLException: Parameter
    Type Conflict [Caused by: Parameter Type Conflict]
    ; nested exception is:
    ORABPEL-11811
    Error while trying to prepare and execute an API.
    An error occurred while preparing and executing the
    JANB.PROC_WITH_CLOB_INOUT_PARAMETER API. Cause: java.sql.SQLException: Parameter
    Type Conflict [Caused by: Parameter Type Conflict]
    Check to ensure that the API is defined in the database and that the
    parameters match the signature of the API. Contact oracle support if error
    is not fixable.
    </summary>
    </part>
    In BPEL 10.1.2.0 this isn't a problem. I tested it against a 10.2.0.1 and a 10.2.0.2 database and in both situations I get the error with BPEL 10.1.3.1 and no error with BPEL 10.1.2.0
    it appears to be a problem in the database adapter...
    anyone with the same problems and/or a solution?

    Not of any use to you, but we had exactly the same problem on Friday when we applied AS 10.1.2.2 Patchset on top of BPEL 10.1.2.0.2.
    The clob in our pl/sql proc wan't declared as in/out but for some reasons JDeveloper had created a clob on the Output Parameter type in the db partner link xsd. I removed this and it worked. This code had been untouched , and working fine, for months.
    I'll be raising an SR today.
    Rob J

  • Database procedure with IN/OUT parameters

    Hi,
    I have a procedure with multiple OUT parameters,
    but I do not know how to get the values of these out parameters in the calling procedure.
    What I mean is I can simply get the value of a function from a calling procedure as:-
    declare
    val1 number;
    begin
    val1 := func_get_num;
    end;
    How can I get the values of OUT parameters of a procedure in a similar way?

    like
    SQL> var ename_v varchar2(30);
    SQL> var empno_v number;
    SQL> create or replace procedure get_employee(empno out number, ename out varchar)
      2  as
      3  begin
      4     select empno, ename into empno, ename from emp where rownum <=1;
      5  end;
      6  /
    Procedure created.
    Elapsed: 00:00:00.51
    SQL> exec get_employee(:empno_v, :ename_v);
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.12
    SQL> print empno_v
       EMPNO_V
           666
    SQL> print ename_v;
    ENAME_V
    fdddfdf1
    SQL>

  • Reg:execute procedure with in out parameters

    hi,
    what is the code to execute a procedure with in out parameters.can anyone give me an example
    thanks

    872296 wrote:
    thanks for the reply.
    i am very much new to oracle database.i need this code to put in one of my informatica mapping.
    so can you just elaborate what does 'karthick' mean?is it the name of the procedure.No, karthick is the value of the variable that is being passed into the procedure called "P" in karthicks example, then if that procedure changes the value inside, the variable will have that new value passed back out of the procedure to it.
    PROCEDURE prc_mv (name VARCHAR2)
    IS
    BEGIN
    dbms_mview.refresh (mv_name);
    END prc_mv;
    PROCEDURE refresh (response IN OUT NUMBER)
    IS
    BEGIN
    dbms_mview.refresh('mv1','C');
    dbms_mview.refresh('mv2','C');
    response := 1;
    EXCEPTION
    WHEN OTHERS
    THEN
    response := 0;
    END refresh;
    can you give the code for this procedure.Yes.
    DECLARE
      v_response NUMBER;
    BEGIN
      refresh(v_response);
    END;Though your code is awful. There's no point in having the response parameter as an IN OUT if you're not going to pass IN a value and use that in the code anywhere. In your case it only needs to be an OUT parameter because you're just passing back OUT a value. You are also masking any exceptions that happen by using a WHEN OTHERS clause.
    Better code would be something like...
    FUNCTION refresh (mv_name) RETURN NUMBER IS
      v_response NUMBER := 0; -- default response value
      e_mv_not_exist EXCEPTION; -- exception variable
      PRAGMA EXCEPTION_INIT(e_mv_not_exist, -23401); -- connect exception name to internal oracle error number
    BEGIN
      dbms_mview.refresh(mv_name,'C');
      v_response := 1;
    EXCEPTION
      WHEN e_mv_not_exist THEN -- handle specific expected exception
        -- if the materialized view does not exist, handle it gracefully as we don't want to stop
        response := 0;
    END refresh;
    declare
      v_response NUMBER;
    begin
      v_response := refresh('mv1');
      if v_response = 0 then
        -- the materialized view did not exist
      else
        -- the materialized view refreshed ok
      end if;
    end;where your exception handler explicity checks for expected exceptions such as :
    ORA-23401: materialized view "SCOTT"."FRED" does not exist... and any other exceptions that you're not expecting will be raised for you to see.
    It's also better as a function because you don't need to pass in a response value, you just want to get a response value back.
    There's rarely a good need to use OUT or IN OUT parameters. (there's some cases, but it's not something to consider doing as part of your regular design)

  • Calling Oracle procedure with two OUT parameters

    Hi I am having an Oracle procedure which return ref cursor. I also want to result one more out parameter result. How Can I call the procedure in SQL. Below is the way I am calling my stored procedure with one parameter.
    proc_Test (p_resultset=> My_cursor)
    How can I call the procedure when I have one more OUT parameter. Second parameter returns 0 or 1.
    Thanks in adv

    Yes its possible to use multiple parameter as OUT type in procedure.
    SQL>set serveroutput on size 1000000;
    SQL>CREATE OR REPLACE PROCEDURE myproc(p_cv OUT SYS_REFCURSOR, p_num OUT NUMBER) AS
      2  BEGIN
      3    OPEN p_cv FOR SELECT 'Hello Oracle' sayhello FROM DUAL ;
      4    p_num := 1;
      5  END;
      6  /
    Procedure created.
    SQL>VAR cv REFCURSOR;
    SQL>VAR num NUMBER;
    SQL>EXEC myproc(:cv, :num);
    PL/SQL procedure successfully completed.
    SQL>PRINT cv;
    SAYHELLO
    Hello Oracle
    SQL>PRINT num;
           NUM
             1
    SQL>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Calling a Procedure with IN & OUT Parameters

    Hello,
    I usually call my procedures using the following way
    declare variable error_msg varchar2(50)
    exec simple_msg('ABC,'ABC','ABC',:error_msg);
    CREATE OR REPLACE PROCEDURE SIMPLE_MSG (
    ID IN VARCHAR2,
    URL IN VARCHAR2,
    LIST IN VARCHAR2,
    ERROR_MSG OUT VARCHAR2
    Now my question is i am trying to call a proc which has IN OUT parameters. Can somebody guide me on how to call the proc. Thanks
    CREATE OR REPLACE PROCEDURE SIMPLE_MSG (
    ID IN VARCHAR2,
    URL IN VARCHAR2,
    LIST IN VARCHAR2,
    NAME IN OUT VARCHAR,
    ERROR_MSG OUT VARCHAR2

    Hi,
    IN OUT parameters are passed just like OUT paramenters: you must pass a variable.
    If you need to set the IN OUT parameter before calling the procedure, then either
    (a) use a separate EXEC command:
    EXEC  :name := 'Original name';
    EXEC  simple_msg ('ABC', 'ABC', 'ABC', :name, :error_msg);or
    (b) use an anonymous PL/SQL block, like this:
    BEGIN
        :name := 'Original name';
        simple_msg ('ABC', 'ABC', 'ABC', :name, :error_msg);
    END;
    /The parameter can be either a bind variable (as shown above), or a local variable (that can be used only in the block).

  • SQLException Calling Stored Procedure with Date OUT Parameters

    Hi,
    I'm trying to call a stored procedure in Oracle 10.1.0.4 using JDBC driver version 10.1.0.5. Here is the Stored procedure I'm trying to call:
    CREATE OR REPLACE PROCEDURE get_collector_segment_info (
    cid IN eb_collector_segment_iot.collector_id%TYPE,
    cnum IN eb_collector_segment_iot.collector_num%TYPE,
    sct OUT NOCOPY coll_seginfo_segment_codes,
    snt OUT NOCOPY coll_seginfo_segment_names,
    st OUT NOCOPY coll_seginfo_statuss,
    sdt OUT NOCOPY coll_seginfo_start_dates,
    edt OUT NOCOPY coll_seginfo_end_dates
    AS
    coll_id eb_collector_segment_iot.collector_id%TYPE;
    err_msg VARCHAR2 (1000);
    BEGIN
    -- Check if collector_id is present. If not, get the collector ID using collector Num
    IF cid IS NULL
    THEN
    coll_id := eb_collector_segment_get_cid (cnum, err_msg);
    IF err_msg IS NOT NULL
    THEN
    raise_application_error
    (-20001,
    'Error while getting Collector ID for Collector Num: '
    || cnum
    || ', Msg: '
    || err_msg
    END IF;
    ELSE
    coll_id := cid;
    END IF;
    -- Return the Segments
    SELECT ecs.segment_code, es.segment_name, es.status, ecs.start_date,
    ecs.end_date
    BULK COLLECT INTO sct, snt, st, sdt,
    edt
    FROM eb_collector_segment ecs, eb_segment es
    WHERE ecs.collector_id = coll_id
    AND ecs.segment_code = es.segment_code
    AND es.status = '1';
    IF SQL%ROWCOUNT = 0
    THEN
    raise_application_error
    (-20002,
    'No Segment records found for Collector ID: '
    || coll_id
    END IF;
    END get_collector_segment_info;
    ecs.segment_code, es.segment_name and es.status are of type VARCAHR2 and ecs.start_date and ecs.end_date are of type DATE. I wrote the following code to call the above store procedure:
    connection = this.datasource.getConnection();
    oracleCallableStatement = (OracleCallableStatement) connection.prepareCall("begin " + STORED_PROCEDURE_NAME
    + "(?, ?, ?, ?, ?, ?, ?); end;");
    oracleCallableStatement.setNull("cid", Types.VARCHAR);
    oracleCallableStatement.setLong("cnum", collectorNum);
    oracleCallableStatement.registerIndexTableOutParameter(3, 100, OracleTypes.VARCHAR, 100);
    oracleCallableStatement.registerIndexTableOutParameter(4, 100, OracleTypes.VARCHAR, 100);
    oracleCallableStatement.registerIndexTableOutParameter(5, 100, OracleTypes.VARCHAR, 100);
    oracleCallableStatement.registerIndexTableOutParameter(6, 100, OracleTypes.DATE, 0);
    oracleCallableStatement.registerIndexTableOutParameter(7, 100, OracleTypes.DATE, 0);
    resultSet = oracleCallableStatement.executeQuery();
    When I run the code, I get a "java.sql.SQLException: Invalid PL/SQL Index Table" exception on oracleCallableStatement.executeQuery(). I tried many other variations and searched on forums but nothing worked for me. Does anyone have any idea? I'm really desparate. i use JDK 1.4.2_12 and WebLogic 8.1 SP6.
    Thanks,
    Zhubin
    Message was edited by:
    zhoozhoo
    Message was edited by:
    zhoozhoo

    Hi Avi,
    I think you are right and I was using the wrong method. With some help from our DBA the problem was resolved Here is the correct code:
    connection = this.datasource.getConnection();
    oracleCallableStatement = (OracleCallableStatement) connection.prepareCall("begin " + STORED_PROCEDURE_NAME
    + "(?, ?, ?, ?, ?, ?, ?); end;");
    oracleCallableStatement.setNull(1, Types.VARCHAR);
    oracleCallableStatement.setLong(2, collectorNum);
    oracleCallableStatement.registerOutParameter(3, OracleTypes.ARRAY, "COLL_SEGINFO_SEGMENT_CODES");
    oracleCallableStatement.registerOutParameter(4, OracleTypes.ARRAY, "COLL_SEGINFO_SEGMENT_NAMES");
    oracleCallableStatement.registerOutParameter(5, OracleTypes.ARRAY, "COLL_SEGINFO_STATUSS");
    oracleCallableStatement.registerOutParameter(6, OracleTypes.ARRAY, "COLL_SEGINFO_START_DATES");
    oracleCallableStatement.registerOutParameter(7, OracleTypes.ARRAY, "COLL_SEGINFO_END_DATES");
    oracleCallableStatement.execute();
    String[] segmentCodes = (String[]) oracleCallableStatement.getARRAY(3).getArray();
    String[] segmentNumbers = (String[]) oracleCallableStatement.getARRAY(4).getArray();
    String[] segmentStatuses = (String[]) oracleCallableStatement.getARRAY(5).getArray();
    Timestamp[] startDates = (Timestamp[]) oracleCallableStatement.getARRAY(6).getArray();
    Timestamp[] endDates = (Timestamp[]) oracleCallableStatement.getARRAY(7).getArray();
    segments = new Segment[segmentCodes.length];
    for (int i = 0; i < segmentCodes.length; i++) {
    System.out.println(segmentCodes[i] + ' ' + segmentNumbers[i] + ' ' + segmentStatuses[i] + ' ' + startDates[i] + ' '
    + endDates);
    segments[i] = new Segment();
    segments[i].setSegmentCode(segmentCodes[i]);
    segments[i].setSegmentName(segmentNumbers[i]);
    segments[i].setStatus(segmentStatuses[i]);
    if (startDates[i] != null) {
    segments[i].setStartDate(new java.util.Date(startDates[i].getTime()));
    if (endDates[i] != null) {
    segments[i].setEndDate(new java.util.Date(endDates[i].getTime()));
    Thanks,
    Zhubin

  • How to call a oracle procedure with in/out parameter frm unix shell script?

    Hi,
    I need to call an oracle stored procedure from unix script. The procedure has 1 input parameter and 2 output parameter. Please send me the syntax for the same. Based on the output values of procedure, I have to execute some more commands in unix script.
    Thanks and regards
    A

    An example :
    TEST@db102 SQL> select ename, job from emp
      2  where empno = 7902;
    ENAME      JOB
    FORD       ANALYST
    TEST@db102 SQL> create or replace procedure show_emp (
      2     v_empno in      number,
      3     v_ename out     varchar2,
      4     v_job   out     varchar2 )
      5  is
      6  begin
      7     select ename, job into v_ename, v_job
      8     from emp
      9     where empno = v_empno;
    10  end;
    TEST@db102 SQL> /
    Procedure created.
    TEST@db102 SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    [ora102 work db102]$ IN=7902
    [ora102 work db102]$ set `sqlplus -s test/test@db102 << !
    var out1 varchar2(30);
    var out2 varchar2(30);
    set pages 0
    set feed off
    exec show_emp($IN,:out1,:out2);
    print
    exit
    `[ora102 work db102]$ echo $1 $2
    FORD ANALYST
    [ora102 work db102]$                           

  • I need an example of oci V7.3 to call stored procedure with IN/OUT parameters.

    Hi,
    I'm developing an application to access data from Oracle V7.3 using OCI. Is there a way to get the IN, OUT and IN/OUT parameters of a stored procedure from the database ? How can I execute the stored procedures dynamically, through OCI and get the data back ? Is there any sample programs ?
    Any help is appreciated.
    Thanks
    David Lin

    Since ODP.NET does not support Oracle Object type, you can not call this stored procedure directly.
    You can write a wrapper procedure over the existing procedure accepting basic types, e.g. Varchar, Number, etc. and call your stored procedure after creating a object from the basic types.

  • Procedures with sys_refcursor out parameters as apex report source

    I would like to be able to just call packaged stored procedures that return ref cursors as Apex report region sources. Can anyone explain to me why Apex is not able to do this?
    Cheers
    The FunkyMonkey

    I now have a apex report based on a pipelined table function which uses a collection based on the original select query. So the Apex report source is now a one liner with the now reusable code squirrelled away in a package...Happiness, it works a treat. :-)

  • Errer when, Call from java to pl sql procedure with table out parameter

    Hi ,
    Please help me ? It's urgent for me .....
    My Oracle Code is like this ,
    CREATE TABLE TEST_TABLE ( DATE1 DATE, VALUE_EXAMPLE VARCHAR2(20 BYTE), VALUE2_EXAMPLE VARCHAR2(20 BYTE), VALUE3_EXAMPLE NUMBER ); CREATE OR REPLACE TYPE TONERECORDTEST AS OBJECT ( DATE1 DATE, VALUE_EXAMPLE VARCHAR2(20), VALUE2_EXAMPLE VARCHAR2(20), VALUE3_EXAMPLE NUMBER ); CREATE OR REPLACE TYPE TTESTTABLE IS TABLE OF TONERECORDTEST; CREATE OR REPLACE PACKAGE test_collection_procedures AS PROCEDURE testCallProcedureFromJava(start_time IN DATE, end_time IN DATE, table_data OUT TTesttable); END test_collection_procedures; / CREATE OR REPLACE PACKAGE BODY test_collection_procedures AS PROCEDURE testCallProcedureFromJava(start_time IN DATE, end_time IN DATE, table_data OUT TTesttable) IS BEGIN SELECT TONERECORDTEST(date1, value_example, value2_example, value3_example) BULK COLLECT INTO table_data FROM TEST_TABLE WHERE DATE1>=start_time AND DATE1<=end_time; END testCallProcedureFromJava; END test_collection_procedures;
    And my Java Code is like
    import java.sql.Connection; import java.sql.DriverManager; import oracle.jdbc.OracleCallableStatement; import oracle.jdbc.OracleTypes; import oracle.sql.ARRAY; import oracle.sql.ArrayDescriptor; import oracle.sql.STRUCT; import oracle.sql.StructDescriptor; public class testPLCollectionType { public static void main(java.lang.String[] args) { try{ //Load the driver Class.forName ("oracle.jdbc.driver.OracleDriver"); // Connect to the database Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@serverbd:1521:squema1","user", "password"); // First, declare the Object arrays that will store the data (for TONERECORDTEST OBJECT TYPE) Object [] p2recobj; Object [] p3recobj; Object [] p4recobj; // Declare the Object Arrays to hold the STRUCTS (for TTESTTABLE TYPE) Object [] p2arrobj; // Declare two descriptors, one for the ARRAY TYPE // and one for the OBJECT TYPE. StructDescriptor desc1=StructDescriptor.createDescriptor("TONERECORDTEST",conn); ArrayDescriptor desc2=ArrayDescriptor.createDescriptor("TTESTTABLE",conn); // Set up the ARRAY object. ARRAY p2arr; // Declare the callable statement. // This must be of type OracleCallableStatement. OracleCallableStatement ocs = (OracleCallableStatement)conn.prepareCall("{call test_collection_procedures.testCallProcedureFromJa va(?,?,?)}"); // Declare IN parameters. Realize that are 2 DATE TYPE!!! Maybe your could change with setDATE ocs.setString(1,"01-JAN-04"); ocs.setString(2,"10-JAN-05"); // Register OUT parameter ocs.registerOutParameter(3,OracleTypes.ARRAY,"TTESTTABLE"); // Execute the procedure ocs.execute(); // Associate the returned arrays with the ARRAY objects. p2arr = ocs.getARRAY(3); // Get the data back into the data arrays. //p1arrobj = (Object [])p1arr.getArray(); p2arrobj = (Object [])p2arr.getArray(); System.out.println("Number of rows="+p2arrobj.length); System.out.println("Printing results..."); for (int i=0; i<p2arrobj.length; i++){ Object [] piarrobj = ((STRUCT)p2arrobj).getAttributes();
    System.out.println();
    System.out.print("Row "+i);
    for (int j=0; j<4; j++){
    System.out.print("|"+piarrobj[j]);
    }catch (Exception ex){
    System.out.println("Exception-->"+ex.getMessage());
    Actually when i running the java program it is showing error
    Exception-->ORA-06550: line 1, column 58:
    PLS-00103: Encountered the symbol "VA" when expecting one of the following:
    := . ( @ % ;
    The symbol ":=" was substituted for "VA" to continue.
      I am not getting the error .Please help me out Dhabas Edited by: Dhabas on Jan 12, 2009 3:49 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    // Declare the callable statement.
    // This must be of type OracleCallableStatement.
    ..."{call test_collection_procedures.testCallProcedureFromJa va(?,?,?)}");Looks like Ja divorced va.

  • Executing procedure with IN OUT parameters using SQL developer

    Hi, I'm trying to exceute the below procedure in SQL developer. Here the IN OUT cursor 'journal_cursor' is already defined.
    PROCEDURE LIST_FORPROJECT (
              p_project_sid IN NUMBER,
              p_journal_cursor IN OUT journal_cursor,
         AS
         BEGIN
              OPEN p_journal_cursor FOR
              -- get the journal
                   SELECT j.JOURNAL_KEY AS "Journal_SID",
                             j.JOURNALTEXT AS "Entry",
                             j.CREATEDATE AS "CreateDate",
                             --j.COMMENT_ AS "Comment",
                             j.PROJECTPHASETASK_KEY AS "ProjectPhaseTaskSet_SID",
                             j.person_key AS "Person_SID"
    FROM vdl_JOURNAL j
                   INNER JOIN vdl_PROJECTJOURNAL pj ON pj.JOURNAL_KEY = j.JOURNAL_KEY
                   WHERE pj.PROJECT_KEY = p_project_sid
                   ORDER BY j.CREATEDATE ASC, j.JOURNAL_KEY ASC;
    END LIST_FORPROJECT;
    When trying to run the above procedure through SQL developer, I get the below code generated.
    DECLARE
    P_PROJECT_SID NUMBER;
    P_JOURNAL_CURSOR journal_cursor;
    BEGIN
    P_PROJECT_SID := 5974;
    -- Modify the code to initialize the variable
    -- P_JOURNAL_CURSOR := NULL;
    -- Modify the code to initialize the variable
    LIST_FORPROJECT(
    P_PROJECT_SID => P_PROJECT_SID,
    P_JOURNAL_CURSOR => P_JOURNAL_CURSOR,
    -- Modify the code to output the variable
    DBMS_OUTPUT.PUT_LINE('P_JOURNAL_CURSOR' || P_JOURNAL_CURSOR);
    END;
    But executing the above sql doesn't print the cursor as output but errors out saying 'wrong number or type or arguments in call to ||'. Can somebody please help me in finding a way test and view the results of such a procedure through SQL developer?
    Any help is highly appreciated.
    Regards,
    Ranganath

    Hi,
    I was able to solve the problem.. My cursor was declared like this.
    TYPE journal_def IS RECORD
              journal_sid                    NUMBER(10),
              journaltext                    CLOB,
              createdate                    DATE,
              projectphasetaskset_sid     NUMBER(10),
              person_sid                    NUMBER(10)
    TYPE journal_cursor                    IS REF CURSOR RETURN journal_def;
    I used the journal_def type to fetch the records.
    Here is how my final sql looked like.
    DECLARE
    P_PROJECT_SID NUMBER;
    P_JOURNAL_CURSOR journal_cursor;
    P_J_CURSOR journal_def;
    BEGIN
    P_PROJECT_SID := 11171;
    -- Modify the code to initialize the variable
    -- P_JOURNAL_CURSOR := NULL;
    LIST_FORPROJECT(
    P_PROJECT_SID => P_PROJECT_SID,
    P_JOURNAL_CURSOR => P_JOURNAL_CURSOR,
    -- Modify the code to output the variable
    BEGIN
    --open P_JOURNAL_CURSOR;
    loop
    fetch P_JOURNAL_CURSOR into P_J_CURSOR;
    exit when P_JOURNAL_CURSOR%NOTFOUND;
    DBMS_OUTPUT.put_line(P_J_CURSOR.journal_sid);
    end loop;
    --close P_JOURNAL_CURSOR;
    END;
    END;
    This gave me results. Thanks a ton ALL for your help..... :)..
    Regards,
    Ranganath

  • How to call sql procedure with parameter from java

    Hello,
    i am trying to call one sql procedure with two parameters from java.
    the first parameter is In parameter, the second is OUT.
    the return value of this java method should be this second parameter value.
    the following is my java code:
    protected String getNextRunNumber() {
         String runnumber=null;
         String sql = "{call APIX.FNC_SST_EXPORT.GET_NEXT_RUNNUMBER (?,?)}";
    CallableStatement state = null;
    try{
         Connection con= getDatabaseConnection();
         state = con.prepareCall(sql);
         state.setString(1, m_appKeyExport);
         state.registerOutParameter(2,Types.NUMERIC,0);
         state.execute();
    ResultSet resultR = (ResultSet)state.getObject(2);
         while (resultR.next()) {
              runnumber=resultR.getBigDecimal(1).toString();
    catch (SQLException e){System.out.println("You can not get the export next run number properly");}
    return runnumber;
    i got error message like:
    java.lang.ClassCastException: java.math.BigDecimal
    As far as i knew, if the parameter is number or decimal, we should give also the paramer scale to the method: state.registerOutParameter(), but i still get this error message.
    Please help me to solve this problem.
    Thanks a lot.

    state.execute();
    i try to use debug to find the problem, in this line, i saw
    OracleCallableStatement(OraclePreparedStatement).execute() line: 642 [local variables unavailable]
    is this the problem?

  • DB Adapter calling PL/SQL Procedure gives error

    Created partner link, calling pl/sql procedure with one in variable and one out variable. Invoke works fine. Assigning pl/sql return value to output is causing run time error. "Rebuild" and "Deploy" works file.
    Here is the error:
    Assign_2
    [2007/08/03 14:18:06]
    Error in evaluate <from> expression at line "93". The result is empty for the XPath expression : "/ns3:OutputParameters/ns3:OUT_STATUS_CODE".
    oracle.xml.parser.v2.XMLElement@ba1893
    Copy details to clipboard
    [2007/08/03 14:18:06]
    "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.
    - <selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    - <part name="summary">
    <summary>
    empty variable/expression result.
    xpath variable/expression expression "/ns3:OutputParameters/ns3:OUT_STATUS_CODE" is empty at line 93, when attempting reading/copying it.
    Please make sure the variable/expression result "/ns3:OutputParameters/ns3:OUT_STATUS_CODE" is not empty.
    </summary>
    </part>
    </selectionFailure>
    Any input would be appreciated..
    Thanks.

    Thanks, it works.
    In the “Assign Variables”
    Changed from:
    <copy>
    <from variable="Invoke_1_ASNDBTest103_OutputVariable"
    part="OutputParameters" query="/ns3:OutputParameters/ns3:OUT_STATUS_CODE"/>
    <to variable="outputVariable" part="payload"
    query="/ns2:ASNReturnStatus102"/>
    </copy>
    Changed to:
    <copy>
    <from variable="Invoke_1_ASNDBTest103_OutputVariable"
    part="OutputParameters" query="/ns3:OutputParameters"/>
    <to variable="outputVariable" part="payload"
    query="/ns2:ASNReturnStatus102"/>
    </copy>
    So far so good, but one question, compiler gives warning…but everything works well.
    Warning(97):
    [Error ORABPEL-10041]: Trying to assign incompatible types
    [Description]: in line 97 of "C:\HOME\jdevOAExt3\jdevhome\jdev\mywork\ASNTest101\BPELProcess1\bpel\BPELProcess1.bpel", <from> value type "{http://xmlns.oracle.com/pcbpel/adapter/db/APPS/XRX_BPEL_INSERT_ASN_TMP102/}OutputParameters anonymous type" is not compatible with <to> value type "{http://www.thiscompany.com/ns/sales}ASNReturnStatus102".
    [Potential fix]: Please make sure that the return value of from-spec query is compatible with the to-spec query.
    Also, instead of direct variable to variable copy, used expression to variable copy and it works. You can avoid the warning from the compiler.
    Does not work ==> bpws:getVariableData('Invoke_1_ASNDBTest103_OutputVariable','payload','/ns3:OutputParameters/ns3:OUT_STATUS_CODE')
    Works ==> bpws:getVariableData('Invoke_1_ASNDBTest103_OutputVariable','payload','/ns3:OutputParameters’)
    So, why the compiler warning?

  • Calling PL/SQL Procedures from Java

    Hello,
    I want to know, if it is possible to call PL/SQL Procedures from
    SQLJ(which uses htp.print from the Package web toolkit ).
    Though, it is possible to call normal procedures but if I want
    to call PL/SQL procedures with htp.print then I get I error.
    For example:
    #sql{Call html_test()};
    Can you give me a advice?
    Your help is much appreciated!
    M|ller

    Oracle's htp packages are develop to be work with
    mod_plsql/OAS/OWS webserver.
    If you are trying to use htp packages first need to instanciate
    some enviroment vars for htp packages, for example first you has
    to call to owa.initialize procedure, populate owa.cgi array and
    so on.
    If you need more information about how this toolkit works you
    could get the source of DB Prism at
    http://www.plenix.com/dbprism/ this open source framework
    includes backward compatibility with mod_plsql application and
    then includes settings of this values from Java code.
    Best regards, Marcelo.

Maybe you are looking for