Curious thing while calling a procedure from Java !...

Hi !. My name is Agustin and my doubt would be the following one... I am working for a e-business comp and they asked me to call a procedure from java... The code is the following one:
CallableStatement cs = null;
System.out.println("Fecha Nro. 1: " + paramFechaDesde);
System.out.println("Fecha Nro. 2: " + paramFechaHasta);
try
cs = getDBTransaction().createCallableStatement("{call paq_w_ListadoSiniestralidadART. p_sinsiniest(?,?,?,?) }",0);
cs.registerOutParameter(4,OracleTypes.VARCHAR);
cs.setInt(1,paramContrato.intValue());
cs.setString(2,paramFechaDesde);
cs.setString(3,paramFechaHasta);
cs.setString(4,paramNombreArchivo);
cs.executeQuery();
String nomArchivo = cs.getString(4);
System.out.println("### " + nomArchivo +" ###");
catch(SQLException e)
The weird thing is that, I was expecting a big big exception but the only thing I got is
### Error ###
The String I am expecting is a file's name !; so I am a little bit confused...
Also I didn't know where to post so If it's in the wrong category... I apologize !... If anyone need more details, I'll be checking out... The account I am working on is an Insurance company, who is the one who provide access to the DB and the procedures... So I can't check what's inside...

Please provide your Java and OS versions, the JDBC jar file and the Oracle DB version being used when you post.
>
I was expecting a big big exception
>
Then why do you have an empty exception block? That just makes it disappear so you won't see one if it happens.
And your code has
cs.registerOutParameter(4,OracleTypes.VARCHAR);
cs.setString(4,paramNombreArchivo);You use 'registerOutParameter' for an OUT parameter and the 'setXXX' methods for other parameters.
Remove the 'setSTring' for the OUT parameter.
Then as malcollmmc already said
>
Sounds like the PL/SQL is returning "Error" as the 4th parameter of the call
>
The actual value returned by PL/SQL is strictly determined by the PL/SQL code and Java and JDBC are not involved.
Fix the code problems, retest, and folllowup with whoever wrote the code if it still returns ERROR.

Similar Messages

  • Error while calling stored procedure from Java

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

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

  • Exception while calling BPEL process from JAVA

    Hi All
    I am getting this error while calling BPEL process from JAVA
    first I've got javabeans exception then I changed the port to default 23791 .. now I am getting the following
    Exception in thread "main" oracle.adf.mds.exception.MDSRuntimeException: Cache not initialized
         at oracle.apps.fnd.framework.mds.cache.ATGCacheMgrDelegateImpl.<init>(ATGCacheMgrDelegateImpl.java:325)
         at oracle.apps.fnd.framework.mds.cache.ATGCacheFactoryImpl.<init>(ATGCacheFactoryImpl.java:44)
         at oracle.apps.fnd.cp.request.CpContext.getMDSContext(CpContext.java:1084)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:130)
    can anyone help

    Sorry guys for disturbing.
    I deleted the file CacheDefaultConfig.properties by mistake from $JAVA_TOP
    I replaced it and it worked fine
    Thanks,
    Baraa

  • Error while calling a procedure from ESB

    Hi,
    I am calling a procedure from ESB using DB adapter. and in the routing rules i am mapping the i/p values for schema to procedure input variables using mappings(transformation) but the values are going as null to the procedure call.
    Please help me out.
    The exception follows...
    An unhandled exception has been thrown in the ESB system. The exception reported is: "org.collaxa.thirdparty.apache.wsif.WSIFException: esb:///ESB_Projects/ESB-Issues_issue3/db3.wsdl [ db3_ptt::db3(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'db3' failed due to: Error while trying to prepare and execute an API.
    An error occurred while preparing and executing the SYSTEM.INSERT_ISSUE_PROC API. Cause: java.sql.SQLException: ORA-01400: cannot insert NULL into ("SYSTEM"."ISSUES"."ISSUE_NAME")
    ORA-06512: at "SYSTEM.INSERT_ISSUE_PROC", line 16
    ORA-06512: at line 1
    [Caused by: ORA-01400: cannot insert NULL into ("SYSTEM"."ISSUES"."ISSUE_NAME")
    ORA-06512: at "SYSTEM.INSERT_ISSUE_PROC", line 16                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    This is likely being caused by a problem that we've seen a number of times. You'll have namespace issues and problems with NULLs if your JDev is 10.1.3.1 and SOA is 10.1.3.3 (or vice-versa). You MUST synchronize JDev 10.1.3.3 (or higher) with SOA 10.1.3.3 (or higher). It doesn't matter if you mix 10.1.3.3 and 10.1.3.4. You just need to get away from 10.1.3.1.

  • Calling Stored Procedures from JAVA Application

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

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

  • Calling stored procedure from Java raises ORA-1722 exception

    Hi,
    As the title says, when I call the stored procedure from java I got the exception ORA-1722 (invalid number) but I've checked and rechecked my procedure on SQL-Developer and It's alright it works nice and clean !
    What's happening? is there something I'm missing?
    The way I call the stored procedure is:
        public void execProcedure(String procedure) {
            CallableStatement cs;
            try {
                cs = conn.prepareCall(procedure);
                cs.execute();
            } catch (SQLException ex) {
                Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
         where
        String procedure = "{call validateinfo}"I really need help on this, it's frustraiting me 'cause I need to finish a system but this little big problem is killing me ...
    Thanks any advice is very welcome :)

    Thanks for your help. Haven't tested the SP with a DB access client... which one do you recommend to use?
    The SP is the following:
    create or replace
    PROCEDURE validateInfo IS
      var number;
    BEGIN
      UPDATE temp_desarrollo
      SET status = '1';
      COMMIT;
      // Some string validations ...
      //This one just checks if the value of "monto" is a number
      //This update goes good
      UPDATE temp_desarrollo tmp
      SET cve_status = Decode(cve_status, NULL, '15', cve_status||',15')
      WHERE IsNumber(tmp.monto) = 'F';
      COMMIT;*/
      //This one just checks if the value of "monto" is greater than 0
      //if not, change de add to cve_status an errorValue
      UPDATE temp_desarrollo tmp
      SET cve_status = Decode(cve_status, NULL, '14', cve_status||',14')
      WHERE (cve_status NOT LIKE '%15%' OR cve_status IS NULL)
      AND to_number(tmp.monto) <= 0;
      COMMIT;
      //More string validations
      EXCEPTION
        WHEN OTHERS THEN
          var := SQLCODE;
          insert into excepciones values(to_char(var));
    END;I've deleted much code from the SP since I know there's nothing to do with the excepcion, just that UPDATE statement is the one giving me the exception.
    If those two UPDATES statements work with the same field (monto) why the first one is succeding and the second one not?
    Cheers,
    Federico
    P.S. the "isNumber" function is as follows, just in case.
    create or replace
    function IsNumber(val1 varchar2) return varchar2 is
      n number := null;
    begin
      n := to_number(val1,'9999999999999999.99');
        return 'T';
      exception
        when others then
          return 'F';
    end;

  • UnsatisfiedLinkError while calling C library from Java Programm

    Hi,
    I am trying call C function from Java code but I am getting error.
    Below is the code
    package jnitest;
    class HelloWorld {
        private native void print();
        public static void main(String[] args) {
            new HelloWorld().print();
        static {
            System.loadLibrary("HelloWorld");
    }I used following commands to compile and generate header files
    $ javac -d build src/jnitest/HelloWorld.java
    $ javah -d build -classpath build -jni jnitest.HelloWorldThen jnitest_HelloWorld.h was generated and I renamed it to HelloWorld.h.
    I implemented HelloWorld.h in HelloWorld.c.
    Below is the code for both the files
    HelloWorld.h
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class jnitest_HelloWorld */
    #ifndef _Included_jnitest_HelloWorld
    #define _Included_jnitest_HelloWorld
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class:     jnitest_HelloWorld
    * Method:    print
    * Signature: ()V
    JNIEXPORT void JNICALL Java_jnitest_HelloWorld_print
      (JNIEnv *, jobject);
    #ifdef __cplusplus
    #endif
    #endifHelloWorld.c
    #include <jni.h>
    #include <stdio.h>
    #include "HelloWorld.h"
    JNIEXPORT void JNICALL
    Java_HelloWorld_print(JNIEnv *env, jobject obj)
      printf("Hello World!\n");
      return;
    }I used following commands to generate so file
    gcc -m32 -fPIC -D_REENTRANT -I/opt/jdk1.6.0_19/include -I/opt/jdk1.6.0_19/include/linux -c HelloWorld.c
    gcc -m32 -shared HelloWorld.o -o libHelloWorld.soafter all the execution I get following directory struct in build directory
    $ ls -R
    HelloWorld.c  HelloWorld.h  jnitest  libHelloWorld.so
    ./jnitest:
    HelloWorld.classI am executing following command to run the program.
    build$ java -D. jnitest.HelloWorldbut I am getting exception
    Exception in thread "main" java.lang.UnsatisfiedLinkError: jnitest.HelloWorld.print()V
         at jnitest.HelloWorld.print(Native Method)
         at jnitest.HelloWorld.main(HelloWorld.java:16)I pointed LD_LIBRARY_PATH to build directory and executed
    java -classpath build jnitest.HelloWorldbut I am still getting the same error.
    Please help to fix the issue.
    Thanks,

    The JNI method name in the .h file is different to that in the .c file.

  • How to call stored procedures from java program?

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

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

  • Calling stored procedure from java...

    Hello,
    I've got a stored procedure that works correctly if I call it in Toad like:
    declare
    c CLOB;
    BEGIN
    GETLOCATIONSVOXML (c, '0087890', 8, 2007);
    END;
    no problems there however I'm trying to call it from java..
    public String getDALocations(String inEmplid, Date weekEndDate ) throws Exception {
              Connection connection = null;
              Clob loc;     
              String rtnSt = "";
              SimpleDateFormat yy = new SimpleDateFormat("yyyy");
              SimpleDateFormat ww = new SimpleDateFormat("ww");     
              try     {
                   connection = getConnection();           
                   CallableStatement  cs = connection.prepareCall(SQL_GETDALOCATIONXML);
                   cs.registerOutParameter(1,oracle.jdbc.driver.OracleTypes.CLOB);
                   cs.setString(2, inEmplid);
                   cs.setString(3, ww.format(weekEndDate));          
                   cs.setString(4, yy.format(weekEndDate));               
                   cs.execute();
                   loc = (Clob)cs.getClob(1);
                   rtnSt = "<node label='locations'>" + loc.getSubString(1,(int)loc.length()) + "</node>";
                   cs.close();
                    log.debug("retrieved xml locations");
              catch ( SQLException e ){
                   log.error("LocationDAO.getDALocations() failed", e);
                   throw new Exception(e);
              }     finally     {             
                   releaseConnection(connection);
    return rtnSt;          
    [pre]
    I'm getting the <node label='locations'></node> back, but nothing in between..
    Anyone offer any suggestions or ideas I can try? I'm wondering if the data in Oracle is being read incorrectly.. Is there anyway I can check that?
    Thanks so much!
    Thanks!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    aha! seems to be a problem with my proc...
    select c_schedulestatusid as status
    from schedule_status
    where location = 4131
    and week = 11
    and year = 2007
    [pre]
    part of my proc is returning null.. arg stupid error...                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Execute immediate issue while calling a procedure from plsql block

    Hi all,
    I have the following simple code ,my execute immediate is not working(I am pasting the error below as well)
    CREATE OR REPLACE PROCEDURE CALL_RAHUL_PROCEDURES
    AS
    strng varchar2(1000);
    BEGIN
    for i in (select proc_name,flag,id from rahul_procedures order by id)
    loop
    if (i.flag = 'Y')
    then
    strng := 'exec '||i.proc_name||'(''rahul'')';
    dbms_output.put_line(strng);
    execute immediate strng;
    end if;
    end loop;
    END CALL_RAHUL_PROCEDURES;
    Error:
    Connecting to the database INQDWD.
    ORA-00900: invalid SQL statement
    ORA-06512: at "ETLADMIN.CALL_RAHUL_PROCEDURES", line 17
    ORA-06512: at line 2
    exec RAHUL_HELLO_WORLD2('rahul');
    Process exited.
    Disconnecting from the database INQDWD.
    data in rahul_procedures table :
    Proc_name flag Id
    RAHUL_HELLO_WORLD     N     1
    RAHUL_HELLO_WORLD2     Y     2
    RAHUL_HELLO_WORLD     N     3
    RAHUL_HELLO_WORLD3     N     4
    please help.
    Regards
    Rahul

    Mac_Freak_Rahul wrote:
    Well I have to call 26 procedures one by one and the names of the procedures would be in a table'rahul_procedures' Which is 100% wrong.
    Data is stored in tables, program code is stored in procedures or view defintions.
    http://en.wikipedia.org/wiki/Data_%28computing%29
    >
    Data vs programs
    Typically, different files are used to store programs vs data. Executable files contain programs; all other files are data files.
    >
    So you have just violated the primary distinction between data and program code.
    I dont find anything strange in my question,Only because you do not appear to know what you are doing or the difference between data and program code.
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1943344500346351703
    >
    ugh, what an ugly "design". I can see your life will be full of performance issues, strange 'bugs', and other unpleasant side effects. I mean, it all looks "so cool", but it'll be a nightmare to maintain and enhance.
    but then you have the issue of binds, which will be intractable. You'd have to know the binds at compile time, but you have hidden all of your sql in a magic generic table - so you cannot possibly know your binds at compile time.
    I would suggest you discard all of this code (I am DEAD SERIOUS) and start over. This is a bad idea from the get go. Or at least do me a favor and do not use plsql (you make it look like a good database implementation, but it isn't)
    The objective here is to store SQL Statements in a Table(a sql repository) and just call the required SQL from the application using the sqlid using the sql_execute procedure. ...
    CHANGE YOUR OBJECTIVE.
    How about this for a good objective:
    the objective here is to store sql statement in a plsql routine (a sql repository, you call a procedure and we run sql) and just call the required sql form the applicatoin using the STORED PROCEDURE
    sorry, can I think of hacks to get you going? yes, application contexts come to mind - a fixed number of binds comes to mind. Am I going to work them out? No - it is the wrong way to approach a database application.

  • Problem in calling oracle procedure from java

    Oracle procedure with the following parameters.
    CREATE OR REPLACE PROCEDURE CREDITED_TO_STORE_INSERT (P_CUST# IN NUMBER,
    P_INV_DATE IN DATE,
    P_MEMO# IN NUMBER,
    P_SESS_ID IN VARCHAR2 ) IS
    BEGIN
    /*.........Procedure Body with select and insert statements there no OUT or return variable/value......*/
    END;
    Now i am calling this procedure with the java code in java.
    public boolean execProcedure(String storeNo, String invoiceDate, String claimNo, String sessionID) throws SQLException {
         CallableStatement cstmt = null;
         java.sql.Date invicDate = this.StringToDate(invoiceDate);
         try
         cstmt = conn.prepareCall("{call WEBUSER.CREDITED_TO_STORE_INSERT(?,?,?,?,?,?)}");
         cstmt.setInt(1, Integer.parseInt(storeNo));
         cstmt.setDate(2, invicDate);
         cstmt.setInt(3, Integer.parseInt(claimNo));
         cstmt.setString(4, sessionID);
         cstmt.execute();
         catch (Exception e)
         System.out.println (e);
         } // catch (Exception e)
         finally
         try
         cstmt.close();
         catch (Exception ex)
         } // catch (Exception ex)
         } // finally
         return true;
    But it will return the following exception.
    [STDOUT] java.sql.SQLException: Missing IN or OUT parameter at index:: 5
    i don't know why :( please help me ...

    your procedure has 4 parameters but in the prepared statement you define 6 placeholders

  • Error while calling stored procedure from apps adapter

    Hi,
    I am calling Oracle applications standard api to create ar invoice (XX_BPEL_TEST_APPS_ADAPTER_PKG is the name of wrapper package created by adapter) from apps adapter but getting the following error:
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'test_apps_adapter' failed due to: Stored procedure invocation error. Error while trying to prepare and execute the APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG.AR_INVOICE_API_PUB$CREATE_SIN API. An error occurred while preparing and executing the APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG.AR_INVOICE_API_PUB$CREATE_SIN API. Cause: java.sql.SQLException: ORA-06531: Reference to uninitialized collection ORA-06512: at "APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG", line 199 ORA-06512: at "APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG", line 909 ORA-06512: at line 1 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 "-6531" 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.
    Just wondering if anyone has faced a similar problem?

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

  • Error while calling the BPEL from java program

    Hello All,
    I am tring to call the Synchronous BPEL process from the following code:
    package callbpelfromjava;
    import com.oracle.bpel.client.Locator;
    import com.oracle.bpel.client.NormalizedMessage;
    import com.oracle.bpel.client.delivery.IDeliveryService;
    import java.util.Map;
    import java.util.Properties;
    import oracle.xml.parser.v2.XMLElement;
    public class BPELCaller {
    public static void main(String args[]){
    String input = "krrish";
    String xmlInput= "<ns1:AccessDBBPELProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/AccessDBBPEL\"><ns1:input>"+input+"</ns1:input></ns1:AccessDBBPELProcessRequest>";
    try{        
    Properties props=new Properties();
    props.setProperty("orabpel.platform","ias_10g");
    props.setProperty("java.naming.factory.initial","com.evermind.server.rmi.RMIInitialContextFactory");
    props.setProperty("java.naming.provider.url","opmn:ormi://192.168.137.40:6004/home/orabpel");
    props.setProperty("java.naming.security.principal","oc4jadmin");
    props.setProperty("java.naming.security.credentials","welcome1");
    props.setProperty("dedicated.rmicontext", "true");
    Locator locator = new Locator("default", "bpel", props);
    System.out.println("After creating the locator object......");
    IDeliveryService deliveryService =(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME);
    System.out.println("Befor creating the NormalizedMessage object......");
    NormalizedMessage nm = new NormalizedMessage();
    System.out.println("After creating the NormalizedMessage object.*.*.*...");
    nm.addPart("payload", xmlInput);
    System.out.println("Before creating response object......");
    NormalizedMessage res = deliveryService.request("AccessDBBPEL", "process", nm);
    System.out.println("After calling the AccessDBBPEL .*.*.*...");
    Map payload = res.getPayload();
    System.out.println("BPEL called");
    XMLElement xmlEl=(oracle.xml.parser.v2.XMLElement)payload.get("payload");
    String replyText=xmlEl.getText();
    System.out.println("Reply from BPEL Process>>>>>>>>>>>>> "+replyText);
    catch (Exception e) {
    e.printStackTrace();
    I Included the following jar files:
    Orabpel-ant.jar
    Orabpel.jar
    Orabpel-common.jar
    Orabpel-boot.jar
    Xmlparserv2.jar
    Ejb30.jar
    and getting the exception:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/ejb/EJBException
         at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:76)
         at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:254)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:83)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:53)
         at callbpelfromjava.BPELCaller.main(BPELCaller.java:39)
    Am I doing any thing wrong ?
    Thanks
    Krrish

    Hello Marc,
    Thank you for the reply.
    I could not find some of the jar files in my Jdeveloper 10.1.3.1.0
    ../lib/olite40.jar
    ../lib/wsclient_extended.jar
    ../lib/log4j-1.2.14.jar
    could you please help me locating these jars.
    or If possible, could you mail me those jars at [email protected]
    I have included all other jar files you have listed and getting the following errror:
    java.lang.Exception: Failed to create "ejb/collaxa/system/DeliveryBean" bean; exception reported is: "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found
         at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:52)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:279)
         at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:250)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:83)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:53)
         at callbpelfromjava.BPELCaller.main(BPELCaller.java:39)
         at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:293)
         at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:250)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:83)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:53)
         at callbpelfromjava.BPELCaller.main(BPELCaller.java:39)
    Thanks
    Krrrish

  • Calling a procedure from java, conversion from bigdecimal to number(13,3)

    Hello
    i have a procedure that i call from a java api
    among the parameter that i give to the procedure there is a bigdecimal parameter
    then i have to insert this value in a table
    the colum concerned has number(13.3) as a type
    here is the java call :
    ps.setBigDecimal(5,value );
    so what type should i declare for the procedure parameter for the bigdecimal parameter
    and is there a conversion to do
    Regards
    Sallemel

    Data types are defined by the data not a column definition. What are the range of values possible in the data that must be manipulated. Give examples.

  • Taking control back while calling stored procedure using java programme

    I have stored procedure to load data. This procedure is invoked by java program.
    The stored procedure take around 10 to 15 minutes to do complete loading of database. I want to write stored procedure when it starts loading of database at the same return the control to calling java programme so that java program can do other operation i.e. java program can not wait for control back from stored procedure.
    In short stored procedure runs in background and return control back to java program when stored procedure is invoked. Is it possible then How we can achieve this.

    U can acheive this using Java Threads. Create a thread submit this loading job. Once you submit the thread, you will get the control back to do other stuff.
    Documentation:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Thread.html
    -aijaz

Maybe you are looking for

  • Multiple While Loops Write to One File

    Hello, I have three different instruments from which I am sampling, each at a different sampling rate.  Each instrument is being sampled in its own While loop.  How do I write all the samples I collect to a single text file?  I would like something i

  • Using Parent Functions from Child

    I have created an application utilizing numerous components. Each component encompasses it's own functions. This has become an issue as the application has grown and I need to refresh components based on the click of a tab navigator. Being very new t

  • External Drive Formatting

    I have a spare harddrive id like to use across XP and OSX, however is thee a file format i can format it to, to read/write natively on each without a filesize limit? or is that the silver lining? thanks!

  • Timout error when ADF Swing+BC deployed as Stateful Session Bean

    i deploy the AM as stateful session bean onto OC4J 10.1.3,and the Client access them by Java Web Start. the error message is Exception in thread "AWT-EventQueue-0" oracle.jbo.JboException: JBO-29000: Error resuming transaction; nested exception is:  

  • ZBAPI Creation

    Hi, I am creating ZBAPI with the import parameters as PERNR & SUBTY and export parameters are RETURN1 & RETURN2 and table parameter is IT_ZITEMS The BAPI is fine till creation in SE37 but when i am trying to add the method as API Method in BOR, it is