Can't execute Sybase store procedure

Hi All,
I'm trying to execute sybase store procedure, but somehow the procedure not executing. if any body what's the problem? I'm using JBoss server
Code:
public void deleteRigMapSP(String pMappingID, String rigid, String date,String pPhysicalDel, String database) throws DataAccessException {
GregorianCalendar val = new GregorianCalendar();
DateFormatter dateform = new DateFormatter();
String deletiondate = dateform.convertGregorianToString(val);
query = new StringBuffer("EXECUTE spRR_STAT_DeleteMapping ");
query.append("'"+pMappingID + "',");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append(null + ",");
query.append("'"+deletiondate + "',");
query.append(pPhysicalDel);
System.out.println("query: "+query);
try {
     getDBConnection(ServiceLocator.getInstance().getDataSource(database));
     CallableStatement cs = dbConnection.prepareCall(query.toString());
if (cs.execute()) {
          System.out.println("deleted");
     } else {
          System.out.println("not deleted");
When I try to execute the method it's run fine, but it not executing the procedure.
Any help will be greately appreciated.

How do you know it's not executing? Maybe you're in manual transaction mode and you're not committing the transaction before you close the connection and it gets rolled back.
And why on earth are you using CallableStatement if you're embedding the parameters into the SQL query rather than using placeholders and the setXXX() methods?
Alin.

Similar Messages

  • HOW TO EXECUTE A STORE PROCEDURE THAT RETURN MULTIPLE ROWS FROM A QUERY

    I NEED TO CREATE AND USE A STORE PROCEDURE THAT IS GOING TO DO A SELECT STATEMENT AN THE RESULT OF THE SELECT STATEMENT IS RETURN IN SOME WAY TO THE REQUESTER.
    THIS CALL IS MADE BY AN EXTERNAL LANGUAGE, NOT PL/SQL OR FORMS APPLICATION. USING FOR EXAMPLE ODBC AND VISUAL BASIC. WHAT I NEED TO DO IS ADD A DATA ACCESS LAYER TO MY APPLICATION AND I ALREADY HAVE IT DONE FOR MS SQL SERVER, BUT I NEED THE SAME FUNCTIONALITY ACCESSING AN ORACLE DATABASE.
    FLOW:
    1. VB CREATE A ODBC CONNECTION TO A ORACLE DATABASE
    2. VB EXECUTE A STORE PROCEDURE
    3. THE STORE PROCEDURE RETURNS TO THE VB APPLICATION THE RESULT OF THE QUERY THAT IS INSIDE OF THE STORE PROCEDURE.(I.E. THE STORE PROCEDURE IS A BASIC SELECT, NOTHING COMPLEX)
    4. VB DISPLAY THE RESULT IN A GRID
    FOR SURE I CAN DO THE SELECT DIRECTLY TO ORACLE, BUT FOR PERFORMANCE REASONS AND SCALABILITY, I'LL LIKE IT TO DO IT USING A STORE PROCUDURES
    IS THIS POSIBLE?, HOW?
    THANKS

    Certainly, it's possible. First, define a stored procedure that includes an OUT parameter which is a REF CURSOR. Then, call the stored procedure via ODBC omitting the OUT parameter from the list of parameters. IT will automatically be returned as a result set. Syntax for both is below...
    CREATE PROCEDURE foo (inParam in varchar2, resultSet OUT REF CURSOR )
    In ODBC:
    {call foo( 'someData' )}
    Justin

  • How to use ADO(Microsoft ActiveX Data Objective 2.8 Library) to execute the store procedure of database in SQL server

    how to use ADO(Microsoft ActiveX Data Objective 2.8 Library) to execute the store procedure of database in SQL server?
    Does any body can tell me about this?
    thanks
    [email protected]

    Hi 
    Did you succeed to execute the procedure?
    How ?
    Thanks
    Shimon Zerbib

  • How to execute a store procedure automatically every day

    NT4 and Oracle816,I wanna let Oracle execute a store procedure automatically every day.
    How to do it?
    Thanx.

    There are a few ways to do this: first of all you could write a script file and schedule it to run every night.
    Another solution is to use the DBMS_JOB package. Refer to the documentation to see how it is used

  • Execute ORACLE STORE PROCEDURE from DATABASE

    Hi Everyone...
    i have a store procedure, it has a 5 params, 3 are IN parameters and 2 left are OUT parameters, I need execute this store procedure using a SQL Intruction like this
    DECLARE integracion_sia_kac PROCEDURE FOR KACTUS.SP_SIAKAC_NMDHODO
    :ll_horario,
    :ll_ide_doc,
    :ls_con_kac,
    @PINDREGI=:ls_ind_registro output, @PVALERRO=:ls_error_int output
    USING gt_kactus;
    i think this function is using from MSSQL Server, this has a three IN params but the declaration of the OUT params I don't understand.
    HELP ME!!!!!.... I need know way to execute the SP
    Thanks

    Well it is very simple!
    example:
    CREATE OR REPLACE PROCEDURE PROC1 (P1 IN NUMBER, P2 IN NUMBER, P3 OUT NUMBER) IS
    BEGIN
    P3 := P1 + P2;
    END;
    This is how to use PROC1 from, say, PROC2 :
    CREATE OR REPLACE PROCEDURE SomeShema.PROC2 IS
    Var1 NUMBER(15,2);
    Var2 NUMBER(15,2);
    ReturnParamFromPROC1 NUMBER(15,2);
    BEGIN
    Select SomeField INTO Var1 from Table1 where Table1.ID = 10;
    Select SomeField INTO Var2 from Table2 where Table2.ID = 20;
    PROC1(Var1, Var2, ReturnParamFromPROC1);
    DBMS_OUTPUT.PUT_LINE('Returned value from PROC1 is : '||ReturnParamFromPROC1);
    END;

  • (Resolved) How to execute 2 store procedures in 1 transaction?

    public void method1(){
    Session session = getSessionFactory().acquireSession();
    StoredProcedureCall spc1 = new StoredProcedureCall();
    spc1.setProcedureName("PKG.SP1");
    spc1.addNamedArgumentValue("param", "aaa");
    session.executeNonSelectingCall(spc1);
    StoredProcedureCall spc2 = new StoredProcedureCall();
    spc2.setProcedureName("PKG.SP2");
    spc2.addNamedArgumentValue("param", "bbb");
    session.executeNonSelectingCall(spc2);
    The above method is defined in SessionFacadeBean (just like the EJB in SRDemo),
    I want the above 2 procedures executed in 1 transaction. If spc2 failed, the spc1 should not be committed. How can I do this?
    Regards,
    Jason
    Message was edited by:
    Jason.Lu

    I have changed code as follows:
    public void method1(){
    DatabaseSession session = getSessionFactory().getSharedSession();
    session.beginTransaction();
    try{
    StoredProcedureCall spc1 = new StoredProcedureCall();
    spc1.setProcedureName("PKG.SP1");
    spc1.addNamedArgumentValue("param", "aaa");
    session.executeNonSelectingCall(spc1);
    StoredProcedureCall spc2 = new StoredProcedureCall();
    spc2.setProcedureName("PKG.SP2");
    spc2.addNamedArgumentValue("param", "bbb");
    session.executeNonSelectingCall(spc2);
    } catch (Exception e) {
    session.rollbackTransaction();
    } finally {
    session.release();
    It seems that the "session.rollbackTransaction();" will be executed if spc2 fails.
    toplink logs are as follows:
    [TopLink Info]: 2007.11.12 10:20:36.690--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--default login successful
    [TopLink Finer]: 2007.11.12 10:20:36.690--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--TX beginTransaction, status=NO_TRANSACTION
    [TopLink Finer]: 2007.11.12 10:20:36.705--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--TX Internally starting
    [TopLink Finer]: 2007.11.12 10:20:36.705--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--external transaction has begun internally
    [TopLink Fine]: 2007.11.12 10:20:36.705--ServerSession(1901666)--Connection(11203640)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--BEGIN PKG.SP1(param=>'aaa'); END;
    [TopLink Fine]: 2007.11.12 10:20:36.971--ServerSession(1901666)--Connection(22861541)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--BEGIN PKG.SP2(param=>'bbb'); END;
    [TopLink Warning]: 2007.11.12 10:20:37.440--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070608)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'SP2'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    [TopLink Finer]: 2007.11.12 10:20:37.455--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--TX rollbackTransaction, status=STATUS_ACTIVE
    [TopLink Finer]: 2007.11.12 10:20:37.455--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--TX Internally rolling back
    [TopLink Finer]: 2007.11.12 10:20:37.455--ServerSession(1901666)--Thread(Thread[HTTPThreadGroup-4,5,HTTPThreadGroup])--external transaction has rolled back internally
    The problem is the 1st store procedure is committed (it should be rolled back!), and the database is updated.
    Thanks,
    Jason

  • Execute a Store Procedure in AS400 from Oracle

    Hi..
    I need to invoke a Store Procedure AS/400 from my Oracle Database (Workflow Engine). . How Can do That ??
    Thank you

    Hi Peter,
    is the xml File available for the Orchestrator Runbook Service and the logon account?
    Or are you Running with Runbook tester? ->
    http://www.sc-orchestrator.eu/index.php/scoblog/99-functionality-differences-executing-a-runbook-with-runbook-tester
    Regards,
    Stefan
    www.sc-orchestrator.eu ,
    Blog sc-orchestrator.eu

  • How to execute a store procedure

    Hi Forum
    I have a store procedure with 4 variables in and 1 out, how to execute via sql this procedure for obtain the result in the out variable.
    Thanks and regards

    SQL> create or replace procedure test_proc (
      2     a in number,
      3     b in number,
      4     c in number,
      5     d in number,
      6     outvar out number) is
      7  begin
      8     outvar := a + b + c + d;
      9* end;
    SQL> /
    Procedure created.
    SQL> variable var1 number;
    SQL> exec test_proc (1, 2, 3, 4, :var1);
    PL/SQL procedure successfully completed.
    SQL> print var1
          VAR1
            10
    SQL>

  • How can i execute trigger from procedure

    Hi
    How can i execute trigger when-button-pressed from procedure.
    I knew i have to get the button name and then execute the trigger When-button-pressed.
    but how can i do that.
    Thanks
    null

    how can i execute trigger
    such as When-Button-Pressed on item name "item1"
    and i have more than one trigger with this name on onther
    items
    i know Execute_Trigger('when-button-pressed');
    but any trigger
    for example :
    Execute_Trigger('Item1.when-button-pressed');
    or
    Execute_Trigger('Item2.when-button-pressed');
    or
    other syntax
    i dont know
    please help me
    my email : [email protected]
    Hani

  • Error when I try execute a store procedure

    Hello.
    I did a store procedure, that works well, but when I try to run it in a query in SAP BO, I get an error.
    /select from dbo.JDT1 t0/
    DECLARE @FechaIni Datetime
    /* where*/
    SET @FechaIni = /* t0.RefDate */ '[%0]'
    /select from dbo.JDT1 t0/
    DECLARE @FechaFin Datetime
    /* where*/
    SET @FechaFin = /* t0.RefDate */ '[%1]'
    /select from dbo.OUSR t0/
    DECLARE @UserName nvarchar(30)
    /* where*/
    SET @UserName = /* t0.U_NAME */ '[%2]'
    exec DIM_SP_CorteCajaUsuario @FechaIni, @FechaFin, @UserName
    if I make the following change:
    /select from dbo.OUSR t0/
    DECLARE @UserName nvarchar(30)
    /* where*/
    SET @UserName = /* t0.U_NAME */ 'MARIA JOSE DE PAUL'
    works very well, help me, I need ask for the dates and the user name.
    thanks in advance.
    Oscar

    Try this:
    /*select from dbo.JDT1 t0*/
    DECLARE @FechaIni Datetime
    /* where*/
    SET @FechaIni = /* t0.RefDate */ '[%0]'
    /*select from dbo.JDT1 t0*/
    DECLARE @FechaFin Datetime
    /* where*/
    SET @FechaFin = /* t0.RefDate */ '[%1]'
    /*select from dbo.OUSR t1*/
    DECLARE @UserName nvarchar(30)
    /* where*/
    SET @UserName = /* t1.U_NAME */ '[%2]'
    (I could not tell you why can it work and could not the other.)

  • Can somebody explain this store procedure

    Hi there
    can somebody explain me this Oracle store procedure, I am not able to figure it out anything from this SP :(
    CREATE OR REPLACE PROCEDURE MyDummySchema.MyDummyStoreProcedure
    (a_created_by_proc SomethingDummy.CREATED_BY_PROC%TYPE)
    as
    BEGIN
    /* Set up your global variables */
    XYZ_FORMAT.g_s_created_by_proc := a_created_by_proc;
    XYZ_FORMAT.g_d_current_time := sysdate;
    XYZ_GENERATEEODQUEUE.XYZ_GENERATEQUEUE;
    XYZ_PROCESSQUEUE.XYZ_PROCESSTRADES;
    XYZ_SYNC_SOMETHING(a_created_by_proc);
    END MyDummyStoreProcedure;

    Here
    XYZ_FORMAT, XYZ_GENERATEEODQUEUE, XYZ_PROCESSQUEUE
    are package names;
    XYZ_SYNC_SOMETHING is another PL/SQL procedure name; the procedure takes one parameter;
    XYZ_FORMAT.g_s_created_by_proc, XYZ_FORMAT.g_d_current_time are global variables defined in the package XYZ_FORMAT, in package definition part of it;
    XYZ_GENERATEEODQUEUE.XYZ_GENERATEQUEUE,
    XYZ_PROCESSQUEUE.XYZ_PROCESSTRADES are stored procedures w/o parameters definned in packages XYZ_GENERATEEODQUEUE and XYZ_PROCESSQUEUE respectively.
    But only the author [hopefully] knows what is the point of all this stuff :)

  • Can not execute my created procedure

    Hello
    I have created a package with some procedures and functions, from Duncans site:
    http://djmein.blogspot.com/2007/07/custom-authentication-authorisation.html
    When I look in my SQL Workshop > Object-Browser > Packages
    I see my APP_SECURITY_PKG in the left column, if i cklick on it,
    then I see on right side my Specification and body of my package
    in this case:
    create or replace PACKAGE app_security_pkg
    AS
    PROCEDURE add_user (p_lastname IN VARCHAR2, p_firstname IN VARCHAR2,
    p_email IN VARCHAR2, p_password IN VARCHAR);
    END app_security_pkg;
    ok so far so good
    now I am in my SQL Workshop
    and tried:
    EXECUTE APP_SECURITY_PKG.add_user ('taubek', 'markus', '[email protected]', 'geheim')
    but its not working
    'I am tried also:
    SELECT APP_SECURITY_PKG.add_user ('taubek', 'markus', '[email protected]', 'geheim') from dual;
    but also its not working, it doesnt found my procedure
    ORA-00904: "APP_SECURITY_PKG"."ADD_USER": ungültiger Bezeichner ("ungültiger Bezeichner" means illegal name)
    Can anybody help me?

    Hello Markus,
    You're probably stuck in the synonyms and grants pit.
    Check the owners of the procedures you use in the other procedures. When they're used in different schemes/owners grant execute rights directly (not using a role).
    Also when you use the SQL Workshop tot test your code, be aware that this runs using the APEX_PUBLIC_USER (try : select user from dual).
    So this user needs to be granted to execute the procedures you've created. (And probably you have to define some synonyms).
    Hoffentlich hilft das etwas...
    Regards,
    Roel
    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.logica.com/

  • Can't execute Oracle Stored Procedure using JDBC

    Hi all,
    I'm fairly new to JDBC and Oracle, so pardon my ignorance/lack of knowledge in this subject matter. I am trying to call a stored procedure named get_countries that has no parameters using JDBC. I do this by executing the following lines of code:
    CallableStatement cs = con.prepareCall("{call get_countries}");
    ResultSet rs = cs.executeQuery();But I get the following exception thrown:
    Exception in thread "main" java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'GET_COUNTRIES'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.jdbc.driver.DatabaseError.throwSqlException(_DatabaseError.java:112_)
    at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:331_)
    at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:288_)
    at oracle.jdbc.driver.T4C8Oall.receive(_T4C8Oall.java:745_)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(_T4CCallableStatement.java:218_)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(_T4CCallableStatement.java:969_)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(_OracleStatement.java:1190_)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(_OraclePreparedStatement.java:3370_)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(_OraclePreparedStatement.java:3415_)
    at JDBCTest.main(_JDBCTest.java:44_)
    This makes no sense to me because there are no parameters that I need to pass. So I'm guessing this is something that I don't know about JDBC or about Oracle. I've searched Google for the past hour and a half and still haven't found anything that explains what might be the problem. I've also been following this guide ([http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html]) and I'm doing it exactly the same way, but for some reason it works for them.
    Anyone know what I'm doing wrong?
    Thanks for your help in advance. I really appreciate it!

    I went to a few forums and asked the same question. The boys down at Oracle Community Forums shed some light on this subject and, with their help, I was able to figure it out. Here is the thread for those who want to read: [My Thread @ Oracle Community Forums|http://forums.oracle.com/forums/thread.jspa?messageID=2721348?].
    THE SOLUTION
    cs = con.prepareCall("{ call get_countries(?) }");
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    ResultSet rs = ((OracleCallableStatement) cs).getCursor(1);

  • Execute a Store procedure using Database scheduler.

    Hello Experts,
    I want to create a Database schedule job that will trigger a stored procedure after say 60 mins
    Please provide any pointers or help to accomplish this.
    thanks

    Hi,
    Please try like this.....!!!
    SQL>CONN SYS/PASSWORD  AS SYSDBA;
    CONNECTED
    SQL> ED SAMPLE;
    CREATE OR REPLACE PROCEDURE SAMPLE AS
    BEGIN
    UPDATE SCOTT.EMP SET SAL= SAL+300 WHERE ENAME='ALLEN';
    COMMIT;
    END;
    SQL> ED JOB;
    declare
    begin
      DBMS_SCHEDULER.create_job (
        job_name        => 'SA',
        job_type        => 'STORED_PROCEDURE',
        job_action      => 'SAMPLE',
        start_date      => SYSTIMESTAMP,
        repeat_interval => 'freq=Hourly; INTERVAL=60',
        end_date        => NULL,
        enabled         => TRUE,
        comments        => 'Job defined entirely by the CREATE JOB procedure.');
    end;KPR

  • Execute Store procedure from derived table

    I would like to create a devired table to use in the LOV for my prompt.  Can I execute a store procedure in the defintion of the derived table instead of a sql statement ?  My store procedure is in a sql 2008 database

    Derived Table and SP are not the same. Derived table is more like a database view and is not a replacement for SP. I'd suggest you to use Derived table only if it is not possible to create a database table/view.
    Is it necessary for you to use your stored procedure as a data source? Are you trying to join it's result set to another table or view?
    You can create Materialized view in the database. Use that as a table in Universe.
    Try to use this object LOV in your prompt.

Maybe you are looking for

  • Error message when I try to open the "help" files.

    When I try to open the help files in Elements Photoshop 10, I get the following error message in a pop up box.  At the top, the box is labeled "Adobe AIR"  The message:  "Application descriptor could not be found for this application.  Try re-install

  • External hard drive, restore problem! Files are gone...?

    All the files are gone... but the folders are still there. Here is what happened: Step 1 I restored everything from main HD (two disk striped RAID) to external hard disk (Western Digital MyBook 1TB ). The external disk was mac formated (Mac OS Extend

  • How can i get the footer bar to stay, whilst page scrolls?

    how can i get the footer bar to stay, whilst page scrolls? at the moment, on my site, if the page is longer than the screen, it goes behind the footer, but the foot bar moves up the page as yo scroll down to see the rest of the content. any way of ge

  • Error when installing 10.4.6

    I tried to update to 10.4.6 using the software update. The first installation (a new JSE engine?) went fine). I got an error message from the system update, however. I've tried to download it again maybe 4 times in the last week and keep getting the

  • File read and enque into Queue

    Hi Gurus We have flat file and we have Oracle Advanced Queues . In flat file first line is header and last line is count First line "D00Ïbbbbbb" and footer is "Z00ÏCountof records" In body of file we have Trans_IDÏTRANS_TypeÏTrans_DateÏ<<Table _data