Rollback of JDBC Statement on error - Stored Procedure

Hi All,
We are using the JBDC receiver adapter for inserting the record and for that we are using the Strored Procedure and we have N number of the records for insertion in a single mapping so, we have given the occurence of the Statement 1 : unbounded as, multiple statement will be executed so, my query is if one of statement fails because of some error(Mapping error or data error) what will happen to the statement which are already executed, do they rollback? or it is not possible in case of stored procedure?
Regards,
Gaurav

Hi,
This is one of the solution but i guess there is one more issue, if we have 10 statements and third statement shows error and Stored Exception exception branch is able to catch then it will rollback the previous statement but can we able to restrict another 7 pending statement for execution or not?
Regards,
Gaurav

Similar Messages

  • JDBC Sender adapter - Oracle - Stored Procedure - Error

    Hello,
    Need few clarifications on JDBC sender adapter and stored procedures when connecting to Oracle DB.
    My scenario is, Oracle to SAPBW. So in sender JDBC adapter, we have used a SP having multiple SQL statements it, esp. one of the SELECT statment having Joins on a table and View.
    My questions are,
    1) Is it possible to have more SQL statements in SP for Sender JDBC?
    2) Is the SP of Oracle DB returns resultset or cursor?
    I have tried in searching the forum perticularly for connecting to Oracle as Sender and below like said  that there is a limitation of XI JDBC when connecting to Oracle.
    Executing an Oracle Stored Procedure from Sender JDBC adapter
    So please clarify the doubts and help me.
    With regards,
    Jilan

    Hi Jilan,
    Unlike what was mentioned in the link given by you that oracle returns cursor and not resultset is not completely true. It may be difficult but certainly not impossible.
    Refer : http://www.enterprisedt.com/publications/oracle/result_set.html
    regards
    joel

  • JDBC Receiver to ORACLE Stored Procedure

    Hi Experts
    I browed the forum and could not find a strait answer to my problem. Hence I am posting this thread.
    I have a sync call using JDBC Receiver to ORACLE stored procedure.
    The definition of the procedure is as follows:
    CREATE OR REPLACE procedure TW.XI_TEST
        (p_edi_extract_id varchar2, p_res out edi_extract%rowtype) is
    t edi_extract%rowtype;
    begin
      select *
      into p_res
      from edi_extract e
      where e.edi_extract_id = to_number(p_edi_extract_id);
    exception
       when no_data_found then
            p_res := t;
    end XI_TEST;
    The request XML is as follows:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:MT_EDIExtractSelectionRequest xmlns:ns0="urn:zim.com:tests">
    <STATEMENT>
    <PROC_NAME ACTION="EXECUTE">
      <TABLE>TW.XI_TEST</TABLE>
      <EDI_EXTRACT_ID isInput="true" type="STRING">4223142</EDI_EXTRACT_ID>
      </PROC_NAME>
      </STATEMENT>
      </ns0:MT_EDIExtractSelectionRequest>
    The error I am getting is as follows:
    com.sap.engine.interfaces.messaging.api.exception.MessagingException:
    Error processing request in sax parser:
    Error when executing statement for table/stored proc. 'TW.XI_TEST' (structure 'STATEMENT'):
    java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306:
    wrong number or types of arguments in call to 'XI_TEST' ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Any help would be appreciated.
    Regards
    Effi.

    >
    Rajesh wrote:
    > > Hi Rajesh
    > >
    > > The structure of my data type for the request query is as follows:
    > >
    > >
    DT_EDIExtractSelectionRequest (Complex Type)
    > >    STATEMENT (Element)
    > >       PROC_NAME (Element)
    > >          ACTION (Attribute) _mapped to_: EXECUTE
    > >          TABLE (Element) _mapped to_: TW.XI_TEST
    > >          EDI_EXTRACT_ID (Element) _mapped to_: 123456
    > >             isInput (Attribute) _mapped to_: true
    > >             type (Attribute) _mapped to_: STRING
    > >          EDI_EXTRACT (Element)
    > >             isOutput (Attribute) _mapped to_: true
    > >             type (Attribute) _mapped to_: CURSOR
    > >
    > >
    >
    >
    > Change the DT type to like below
    >
    >            STATEMENT (Element)
    >                   ACTION (Attribute) _mapped to_: EXECUTE
    >                   TABLE (Element) _mapped to_: TW.XI_TEST
    >                   EDI_EXTRACT_ID (Element) _mapped to_: 123456
    >                        isInput (Attribute) _mapped to_: true
    >                        type (Attribute) _mapped to_: STRING
    >                   EDI_ETRACT (Element)
    >                      isOutput (Attribute) _mapped to_: true
    >                     type (Attribute) _mapped to_: CURSOR

    > and try ...actually i dont remeber the exact strucuture..but i tolo faced the same pain of this
    >
    > HTH
    > Rajesh
    Hi Rajesh
    Changing the DT per your suggestion result in the following error:
    <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser:
    No 'action' attribute found in XML document
    (attribute "action" missing or wrong XML structure)</SAP:AdditionalText>
    Omitting the PROC_NAME element from the DT is not correct.
    Also, I would also like to clarify that the variables of the DT I am using are:
    EDI_EXTRACT_ID is defined as string
    EDI_EXTRACT is defined as string
    Because the variable p_res is mapped to nothing in the request payload it does not show.
    I read in one of the posts that this is correct and the variable is used due to the fact the isOutput attribute is true.
    Regards,
    Effi.
    Edited by: Effi Olivkovitch on Dec 6, 2009 9:11 AM
    Edited by: Effi Olivkovitch on Dec 6, 2009 9:18 AM

  • Writing mulitple sql statements in 1 stored procedure

    Hi all, can i know how to create mulitple sql statements in 1 stored procedure??
    Eg the first sql statement will generate few results and my second sql statement will based on the first statement result to execute its second results and my third sql statements will on the second results to generate the final results which will be passed back to jsp pages as a resultset??
    For the time being, i only know how to create a single sql statement in one stored procedure..i had surf through the oracle website but cant find any solution. Can anyone help me?? Samples or links to any website will do.. Thanks alot...

    Hi Irene,
    If I understand your question correctly, then I have already written
    a similar (PL/SQL) stored procedure without any problems.
    However, I do think your question is more suited to the following
    forum:
    http://forums.oracle.com/forums/forum.jsp?id=478021
    I also think it will help others to answer your question if you
    include the following information:
    1. Version of Oracle you are using.
    2. The error message you are getting.
    3. The part of your code that is causing the problem.
    Also, have you looked at the following web sites?
    http://asktom.oracle.com
    http://metalink.oracle.com
    Good Luck,
    Avi.

  • DDL Statements in a Stored Procedure

    Is there some technique which can be used to execute DDL statements in a stored procedure? I want to drop and recreate a table and a number of indexes. Is there a way for me to do this within a stored procedure?
    Thanks in advance for your assistance!!!

    BEGIN
       EXECUTE IMMEDIATE 'CREATE TABLE bonus (id NUMBER, amt NUMBER)';
    END;http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/13_elems18.htm#33889

  • Callable statement with oracle stored procedure error

    i'm calling a stored procedure in java with the following code. However i constantly recieve this error
    so what is going on please HELP
    Parameter Type Conflict: sqlType=2006
    my call statement would be this:
    call Statement = {call getUserByLogin(?,?,?,?)}
    if(storedProcedureName=="getUserByLogin"){
    strCStmt = ("{call " + storedProcedureName +"(?,?,?,?) }");
    cStmt.setObject(1, "system");
    cStmt.setObject(2, "username");
    cStmt.setObject(3,"password");
    cStmt.registerOutParameter(4, java.sql.Types.REF);
    rs = cStmt.executeQuery();
    i've also tried it with a setString as the IN parameter:
    here's the stored procedure:
    CREATE OR REPLACE PROCEDURE getUserByLogin (
    arg_subscriptionName IN varchar,
    arg_loginName IN varchar,
    arg_password IN varchar,
    arg_rec_userinfo_valLanguage OUT types.rec_userinfo_valLanguage
    ) AS
    var_userNum int;
    BEGIN
    select
    u.userNum into var_userNum
    from
    userInfo u,
    subscription s
    where
    s.subscriptionName = arg_subscriptionName AND
    s.subscriptionNum = u.subscriptionNum AND
    u.loginName = arg_loginName AND
    u.password = arg_password;
    if (var_userNum is null) then
    var_userNum := 0;
    end if;
    getUser(var_userNum, arg_rec_userinfo_valLanguage);
    END;

    i'm calling a stored procedure in java with the
    following code. However i constantly recieve this
    error
    so what is going on please HELP
    Parameter Type Conflict: sqlType=2006
    my call statement would be this:
    call Statement = {call getUserByLogin(?,?,?,?)}
    if(storedProcedureName=="getUserByLogin"){
    strCStmt = ("{call " + storedProcedureName +"(?,?,?,?)
    cStmt.setObject(1, "system");
    cStmt.setObject(2, "username");
    cStmt.setObject(3,"password");
    cStmt.registerOutParameter(4, java.sql.Types.REF);
    rs = cStmt.executeQuery();
    i've also tried it with a setString as the IN
    parameter:
    here's the stored procedure:
    CREATE OR REPLACE PROCEDURE getUserByLogin (
    arg_subscriptionName IN varchar,
    arg_loginName IN varchar,
    arg_password IN varchar,
    arg_rec_userinfo_valLanguage OUT
    types.rec_userinfo_valLanguage
    ) AS
    var_userNum int;
    BEGIN
    select
    u.userNum into var_userNum
    from
    userInfo u,
    subscription s
    where
    s.subscriptionName = arg_subscriptionName AND
    s.subscriptionNum = u.subscriptionNum AND
    u.loginName = arg_loginName AND
    u.password = arg_password;
    if (var_userNum is null) then
    var_userNum := 0;
    end if;
    getUser(var_userNum, arg_rec_userinfo_valLanguage);
    END;
    /Hai,
    Try with this if u are using Oracle.
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    (inbetween ur code)
    cStmt.registerOutParameter(4, OracleTypes.CURSOR);
    //in place of "cStmt.registerOutParameter(4, java.sql.Types.REF);"
    Hope u reply with joy.
    regards,
    Siva Kumar Annavaram

  • Got error when use case statement in oracle stored procedure

    Hi,
    I have a query like:
    select merchant_id,
    case
    when product_type='K' then 'Production'
    when product_carrier='UC' THEN 'Shipping'
    end the_type
    from product_tbl
    where merchant_id=10114
    It works fine. But as soon as I put it into a stored procedure, I got error like:
    Encountered the symbol "CASE" when expecting one of the following:
    ( - + mod null <an identifier>
    Please help!

    Oracle 8i doesn't support CASE into PL/SQL, so as Kamal said, create a view with the CASE, and use this view into your PL/SQL.
    Nicolas.
    And an example here :
    Re: Execute Immediate doesnot work in 8i (8.1.7) and Ref Cursor not exec qu
    Sorry Kamal.
    Message was edited by:
    N. Gasparotto

  • JDBC Receiver Adapter - Call Stored Procedure

    Hi,
    I am using a JDBC receiver adapter to call a stored procedure in oracle.
    My target structure looks like:-
    <STATEMENT>
    <storedProcedureName action="EXECUTE">
    <table>realStoredProcedureName</table>
    <serialDate hasQuot="NO" isInputType="true" type="date">TO_DATE('07-15-2008 08:00:11','MM-DD-YYYY HH24:MI:SS')</serialDate>
    <serialNo isInputType="true" type="NUMERIC">123456</serialNo>
    </storedProcedureName>
    </STATEMENT>
    The storedprocedure takes two input values and has one output value.
    The first parameter of the stored procedure is serialDate and the second input parameter is serialNo.
    I am getting an exception:-
    <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'storedProcedureName' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('07"</SAP:AdditionalText>
    Any ideas how to fix this issue.
    Thanks.
    Krishnan

    Hi Krishnan,
    <STATEMENT>
    <storedProcedureName action="EXECUTE">
    <table>realStoredProcedureName</table>
    <serialDate hasQuot="NO" isInputType="true" type="date">TO_DATE('07-15-2008 08:00:11','MM-DD-YYYY HH24:MI:SS')</serialDate>
    <serialNo isInputType="true" type="NUMERIC">123456</serialNo>
    </storedProcedureName>
    </STATEMENT>
    The storedprocedure takes two input values and has one output value.
    The first parameter of the stored procedure is serialDate and the second input parameter is serialNo.
    I am getting an exception:-
    <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'storedProcedureName' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('07"</SAP:AdditionalText>
    In the XML structure you cannot use TO_DATE function . Please pass the DATE in the correct format which the Stored procedure can accept .  Get the out put what you expected from TO_DATE function and use that value in the structure.
    Regards,
    Kishore

  • Problem with JDBC results calling simple stored procedure in VC 7.0

    Hi all,
    I am building a simple VC model which calls a stored procedure on a JDBC database. I have created the system in the portal, defined the alias and user mapping, the connection test is fine and the VC "find data" lists my bespoke stored procedure.
    The stored procedure is :
    CREATE PROCEDURE dbo.dt_getBieUsers
    AS
    select * from dbo.emailuserlink
    GO
    When I test it using query analyser, it returns 3 records each with the two fields I expect - user and email address.
    I drag the model onto the workspace in VC and create an input form ( with just a submit button ). i drag the result port out to create a table. This has no fields in it.
    I build and deploy as flex and the app runs, I click the submit button and SUCCESS! I get 3 records in my table each with 2 fields. The data is all correct. The problem with this is the fields are determined at runtime it seems.
    I go back to the table and add 2 columns "email" and "address".
    i build and deploy and run the app. Again I get 3 records, but this time the contents of all of the rows is not data, but "email" and "address". The data has been replaced by the header texts in all of the rows.
    Can anyone help? Why isn't the data being put in my columns as I would expect?
    I tried to build and deploy the app as Web Dynpro rather than Flex to see if it was a bug in Flex. The application starts but when I click the submit button to run the JDBC stored procedure I get a 500 Internal Server Error
    com.sap.tc.wd4vc.intapi.info.exception.WD4VCRuntimeException: No configuration is defined for the entry JDBCFunction
        at com.sap.tc.wd4vc.xglengine.XGLEngine.createComponentInternal(XGLEngine.java:559)
        at com.sap.tc.wd4vc.xglengine.XGLEngine.getCompInstanceFromUsage(XGLEngine.java:362)
        at com.sap.tc.wd4vc.xglengine.XGLEngine.getCompInstance(XGLEngine.java:329)
        at com.sap.tc.wd4vc.xglengine.wdp.InternalXGLEngine.getCompInstance(InternalXGLEngine.java:167)
        at com.sap.tc.wd4vc.xglengine.XGLEngineInterface.getCompInstance(XGLEngineInterface.java:165)
    The JDBC connection I am using has a connection URL of jdbc:sap:sqlserver://localhost;DatabaseName=BIEUSERS
    and a driver class of com.sap.portals.jdbc.sqlserver.SQLServerDriver
    Can anyone solve my wierd problems?
    Cheers
    Richard

    Hi Richard,
    After you drag and drop the data service, right click on it and choose "Test data service". Then click on "Execute" and after you see the result on the right, click on "Add fields" button (inside the same window). Now you'll see that the fields are on the tabel. This is required only for JDBC data services, since this data (how the resultset is built) is not know in DT and it needs to be run firest - then analysed and only then you have to add the fields to the table).
    Regards,
    Natty

  • DDL statement/s in stored procedures (FUNCTION)

    Hello all,
    I was trying to create a small function that tests keywords on the basis of successful/failed table creation. If a table can be created with a keyword as identifier, it is a non-reserved keyword, if table creation fails, it is a reserved keyword:
    CREATE OR REPLACE FUNCTION createTableForKeyword (keyword VARCHAR) RETURN BOOLEAN IS
    BEGIN
    CREATE TABLE keyword (x NUMBER);
    -- if no exception occurred, table creation succeeded
    DROP TABLE keyword; drop it
    RETURN FALSE; -- FALSE means non-reserved
    EXCEPTION
    WHEN OTHERS THEN
    -- if exception occurred, table creation failed
    RETURN TRUE; -- TRUE means reserved
    END createTableForKeyword;
    This would have been my first PL/SQL program, but I get the following error:
    PLS-00103: Found symbol "CREATE" when expecting one of:
    begin case declare exit ................
    .............. merge pipe
    I had to translate the error message from German, but it should suffice. Obviously DDL statements in functions are not allowed. How do I solve my problem then, given a table that has one column containing the keyword?:
    CREATE TABLE Keywords (keyword VARCHAR(30));
    I was looking too call this function from a loop, but how would I do this without a function? How do I capture table creation fails without exceptions in functions?
    TIA
    Karsten

    To run DDL inside stored procedure you must use Dynamic SQL. Use EXECUTE IMMEDIATE
    To see if a word is a reserved word just query V$RESERVED_WORDS
    Thanks,
    Karthick.

  • Fails to execute all statements in a stored procedure

    We are executing a stored proc on SQL Server 7.0. We are using the jdbc odbc bridge. The procedure has database inserts on seven tables.
    It executes fine when it's executed from the SQL server query analyzer. All the inserts go through without any problem.
    We have a problem when the proc is executed from the front-end. All the inserts except the last two go through without any problem. The sixth insert is partially completed (two out of 300 rows are inserted) and the seventh one is not at all executed.
    No error messages are generated. Surprisingly the stored proc executes fine when executed from the front-end from a Win 98 machine. It's giving a problem only on Win 2000. Could somebody please help us in finding a fix for this problem. Why is it behaving differently when executed from the front-end on a Win 2000 mahinne.
    Thanks in advance.

    Why is it behaving differently when executed from the front-end on a Win 2000 mahinne. Possible reasons.
    -Because you aren't sending the same data.
    -It is has an internal error and that is being ignored.
    -It isn't going to the same database and the stored proc is actually different.

  • JDBC-Adapter-Receiver Calling Stored Procedure with Input-Typ Record

    Hallo,
    I´ m trying calling a stored-procedure with two input-parameter; one of typ record (oracle) and one of type tabel of records. Is this possible (I think there are only types like string, integer etc. possible)? When not is there another possibility to work with that type?
    Thanks in advance,
    Frank

    Hi Frank,
    I think stored procedures will not take Array of Records as a Input. If you want to make a loop funtionality etc then JDBC adapter will work accordingly. You need to just call the stored procedure from the JDBC adapter. It will work for the array of records(multiple occurences).
    Receiver JDBC Procedures.
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Alternative option is you can make use of Java Proxy and from there you can call stored procedure ..I think it is possible.. not tried.
    Hope this helps
    Regards,
    Moorthy

  • JDBC - how to call Stored Procedure

    Hi! My problem is that I can't call a procedure created at my DB through JDBD. I have a similar stored function working fine (code->
    String query = "begin :1 := funcStored; end;";
    CallableStatement cstmt = connection.prepareCall(query);
    cstmt.registerOutParameter(1,OracleTypes.CURSOR);
    cstmt.execute();
    ResultSet rset = (ResultSet)cstmt.getObject(1);
    But I don't want a Stored Function, I want a Stored Procedure that is getting hard making it to work (to call more precisely).
    Here is the wrong code where I need help ->
    String query = "{call ? := procedureStored(P_CURSOR)}";
    That gives a error saying P_CURSOR is not declared but how I declare through Java and call the SP??
    Thanks a lot for helping!
    //The code of SP
    create or replace package types
    as
    type cursorType is ref cursor;
    end;
    create or replace procedure procedureStored( p_cursor out types.cursorType )
    as
    begin
    open p_cursor for SELECT ..........
    end;
    //------------- END

    Problem solved !!
    String query = "{call procedureStored(?)}"; !!!
    and not what i was doing...
    String query = "{call ? := procedureStored(P_CURSOR)}";

  • Error Stored Procedure Upgrading database from SBO 2007A PL42 to SBO 8.8

    Hi,
    When executing the SBO 8.8 PL00  upgrade procedure for databases for an "old" database 2007A PL 42, upgrtade stops whith an error concerning a missing stored procedure "_TmSp_CorrectWrongDocLineNumberInOINMForIPF which is not found".
    The error details says that it occurs on "Stock Updates" step (just after Checks for Payment) and log file gives the following message here after.
    Does anybody have an idea how to upgrade the 2007A database ?
    Thanks
    Error message in log :
    Upgrade          Error              Technical     Failed to call Stored Procedure TmSpCorrectWrongDocLineNumberInOINMForIPF
    Edited by: Michel Diepart on Oct 24, 2009 10:55 PM

    Hi Paul,
    Thanks for your prompt response on a saturday and so late in the evening
    Concerning the Stored Procedure, I would like to delete it but ... it doesn't exist and that's the problem...
    No such procedure in my database (programmability / Stored procedurefolder in SQL).
    When searching on the forum about this stored procedure, no result.
    Does this stored procedure have a link with something regarding adjustment in stock ?
    "Stock updates" : what table is it in SAP B1 ? If necessary I could save the table, create a sql query to re-create it after delete and try to restart the upgrade procedure but I don't know what is the related table...
    I will also try with another 2007A PL 42 database to see if it works.
    Do you know if anybody has already try to upgrade a 2007 PL42 dabase to SBO 8.8 ?
    Best regards

  • Create "dynamic" statements in a stored procedure

    hello
    in my stored procedure I need to write a statement like this:
    FUNCTION myfunct (mytable IN VARCHAR2)
    BEGIN
    EXECUTE IMMEDIATE
    'SELECT COUNT(*)
    INTO myvar
    FROM ' || mytable ||
    'WHERE mycol = ' || currval;
    In short I need to create a sort of "dynamic" statement in which the tablename (nad other...) is a variable....
    but I do not guess it's ok...
    How can I do?

    Hi,
    With dyanmic SQL, the INTO clause is part of the EXECUTE IMMEDIATE statement, not the query.
    Try something like this:
    CREATE OR REPLACE FUNCTION     myfunct
    (       mytable       IN     VARCHAR2
    RETURN     PLS_INTEGER
    IS
         return_num     PLS_INTEGER;
         sql_txt          VARCHAR2 (1000);
    BEGIN
         sql_txt := 'SELECT  COUNT (*)'
              || ' FROM ' || mytable;
         dbms_output.put_line (sql_txt || ' = sql_txt in myfunct');
    --     EXECUTE IMMEDIATE sql_txt INTO return_num;
         RETURN     return_num;
    END     myfunct
    /It's a good idea to develop dynamic SQL as shown above; putting the dynamic statement into a variable that can easily be displayed for debugging.
    When it looks right, then un-comment the EXECUTE IMMEDAITE statement.
    Before moving the code into Production, comment out (or remove) the put_line statement.

Maybe you are looking for

  • Filesystem mounts as read only after boot

    Hi! I have checked the wiki, the forum posts and poked around on the web but haven't found anything helpful. I have just installed arch on my laptop, and after boot the file system is read only. Where do I change it so that it is mounted as read writ

  • HT1430 my iphone 4 has suddenly ceased to work with a full battery and switch will not display slider.  How can I reactivate it?

    My iphone 4 has suddenly ceased to operate with a full battery and switch will not display slider.  How can I reactivate it? Is the memory gone? Will T Mobile replace the memory or the phone if necessary?

  • Interactive Forms and NWDI

    We are having difficulty finding answers on how to control code management and promotion for our Interactive Forms by Adobe projects. We have tried to load our projects into the DTR and are having some issues, but we haven't even found anything that

  • Premiere Pro CS6 still much faster than Premiere Pro CC

    I am currently editing videos that were captured using screen recording software. The files have subsequently been converted to .WMV clips with a data rate of exactly 4.4 MB/sec (that's Megabytes/second). This data rate includes both video and audio.

  • SAP On Dataguard

    Hi, I would like to know the prerequisite and feasibility of implementing DataGuard on SAP ECC 6 which is running with Oracle 10G. I heard Oracle 10G built in with Dataguard. Can someone help me on the details regarding this. We are trying to impleme