Transaction in stored procedure

I have a stored procedure like this:
procedure test() as
begin
insert into table1.....
insert into table2......
insert into table3....
exception
when others then
roolback;
end;
I have 3 question:
1) it is correct my code? I want that in case of error in any insert, all the insert are rollback
2)It is necessary to catch the exception or there is the stored procedure that automatically open transaction and to do commit or roolback?
3)If error happen in second insert, the code jump to the exception or before execute the third insert and then go to the exception code?
Thank you.
Sara.

I have a stored procedure like this:
procedure test() as
begin
insert into table1.....
insert into table2......
insert into table3....
exception
when others then
roolback;
end;
I have 3 question:
1) it is correct my code? I want that in case of
error in any insert, all the insert are rollbackIf an error happens during insert, the rows that inserted in the proc will be rolled back.
2)It is necessary to catch the exception or there is
the stored procedure that automatically open
transaction and to do commit or roolback?It depends on your business rule. If your rules says that in case of any exception all work will ne rolled back, you will do as you mentioned. But ,usally, when an exception happens you can open an automus transaction to log the error in somewhere-DB-
3)If error happen in second insert, the code jump to
the exception or before execute the third insert and
then go to the exception code?
When an exception thrown in a program block, the exception will be propagated until it will cached. Suppose you have a function that call your procedure. If you do not handle the exception, the exception will propagated caller function. If function also could not handled it, it will be thrown. Or sometimes you can wrap up the exception with your business rules.
Regards...

Similar Messages

  • Migrating Transact SQL Stored Procedure & Funtions  to Oracle 9i Procedures

    Is it possible to Migrate Transact SQL Stored Procedure & Funtions in MS-SQL to Oracle 9i Procedures & Funtion . I am an Bigginer in Oracle and SQL.Is their any tool available for this?

    This feature is currently available in the Oracle Migration Workbench. with the Microsoft SQL Server plugins.
    Have you tried it?
    Regards,
    Niall

  • MDB Distributed transaction and stored procedure rollback

    Hi All,
    I am developing an asynchronous application using MDB. My application flow is as follows:
    1. From MDB onMessage i am calling another method MEthodA that
    a. calls a simple pojo1 where I am getting a Connection on XA enable datasource1 and executing Stored Procedure1 of DatabaseSchema1. In Stored Procedure1 I have some inner savpoints and rollback. No commit is inside Stored Procedure1 .
    b. In that pojo withput commiting m closing the connection and coming back in MethodA.
    c. Again from MethodA m calling an different pojo2 where I am getting a new Connection on XA enable datasource2 and executing Stored Procedure2 of DatabaseSchema1.In this pojo also without commiting m closing the connection and coming back in MethodA. In Stored Procedure2 I have some inner savpoints and rollback. No commit is inside Stored Procedure2 .
    d. Again from MethodA m calling pojo1 where I am getting a new Connection on XA enable datasource1 and executing a diffrent function of Stored Procedure1 of DatabaseSchema1.
    Now problem is:
    I have written some Savepoint and rollback inside Stored Procedure1 and inside Stored Procedure2. But these rollback is working only in inside Stored Procedure1 not in inside Stored Procedure2 in each case.
    In ejb-jar.xml transaction attributes is Required for all methods and transaction type is Container.
    Backend is Oracle 10g and init.xa has already been run on that.
    I have tested this on Oc4J and Websphere 6.0.
    I am using XaDatasource.
    Will be very obliged if any one can give a single hint of the problem as soon as possible.
    Thanks a lot

    Hi Kent;
      You have a few choices (AFAIK) with ASE...
    1)  AutoCommit = TRUE
      - must be before connect to your DB
    2) End your PB transaction first. For example
    String ls_end    =  "END TRANSACTION"
    String ls_begin  =  "BEGIN TRANSACTION"
    EXECUTE IMMEDIATE  ls_end using SQLCA;
    <call your SP>
    EXECUTE IMMEDIATE  ls_begin using SQLCA;
    3) use a 2nd Transaction Object for the SP where its AutoCommit = TRUE
    - or -
    4) In your SP ...
    Commit Transaction
    begin transaction
        insert into mytab (pub_id) values ("9999")
    commit transaction

  • Stored Procedure Vs PL-SQL Block

    Hi,
    I came across an interesting problem last week. Fortunately, I was able to solve it or find an acceptable workaround for myself. But wanted to get some clarification from the experts. So posting it here.
    Also, I am new to Orcle, so please excuse any shortcomings in the post.
    My data model has following tables-
    TABLE_PARENT (ID, other columns)
    TABLE_CHILD (ID, other columns, PARENT_ID_FK)
    Here, ID is the primary key column for the respective tables; PARENT_ID_FK is the foreign key referencing the ID column from the TABLE_PARENT.
    I created a stored procedure programmatically (using MS Excel) to insert records in the two tables. The stored procedure has insert statements for an indefinite number of records in the parent table and for every such record, there's a corresponding record inserted in the child table. Here's the sample code.
    BEGIN
    /*first record*/
    parent_id := MY_SEQUENCE_GENERATOR.NEXTVAL;
    INSERT INTO TABLE_PARENT(ID, other columns) VALUES (parent_id, other values);
    INSERT INTO TABLE_CHILD(ID, other values,parent_id );
    /*second record*/
    parent_id := MY_SEQUENCE_GENERATOR.NEXTVAL;
    INSERT INTO TABLE_PARENT(ID, other columns) VALUES (parent_id, other values);
    INSERT INTO TABLE_CHILD(ID, other values,parent_id );
    /*third record*/
    parent_id := MY_SEQUENCE_GENERATOR.NEXTVAL;
    INSERT INTO TABLE_PARENT(ID, other columns) VALUES (parent_id, other values);
    INSERT INTO TABLE_CHILD(ID, other values,parent_id );
    /*and so on*/
    END
    When I run this stored procedure, I keep getting following exception intermittently-
    ORA-02291: integrity constraint violated-parent key not found tips.
    My thinking is that it comes because the insert statements are executing ahead of turn of the parent_id assignment statement. And this is happening possibly because of some parallelism that is taking place during the execution of the stored procedure, or, some sort of optmization that the DB server does (though erroneously) when it compiles the stored procedure.
    I tried out everything that I could think of but it didn't go away. Finally, when I executed the same set of statements as a PL-SQL block, it worked fine.
    To understand it better, I am looking for clarification on the following questions.
    1) Why does the exception come with stored procedure but not with PL-SQL block? Is my reasoning given above correct (parallelism or some sort of optimization coming into play)?
    2) If it is due to parallelism, how to run a Oracle stored procedure with defree of prallelism set to 1?
    3) If it is due to optimization done by the compiler, how to instruct the compiler to not do any such optimization. Also, in any case, isn't it an error to optimize but lose program semantics?
    4) Another question related to the same piece of work I have is to use transactions in the PL-SQL block, I had to explicitly COMMIT/ROLLBACK it in the code. In whatever references I had read, it was said that by default the transaction begins with BEGIN statement and commits with END. Also, it seems to work with a Stored Proedure though. So is it that a PL_SQL block needs explicity call to COMMIT/ROLLBACK to achive transactions but stored procedures do not?
    Any inputs/clarifications will be much appreciated.
    Thank you
    Neelesh

    Ok, your last couple of paragraphs were helpful. Here're the details that were missing in my earlier post.
    - I am on Oracle 10.2.0.
    - Table definitions-
    CREATE TABLE "MYUSER"."TABLE_PARENT"
    *(     "ID" NUMBER(19,0) NOT NULL ENABLE,*
    *     "NAME" VARCHAR2(30),*
    *     "DESCRIPTION" VARCHAR2(80),*
    *     "RULETYPE" NUMBER(10,0) NOT NULL ENABLE,*
    *     "OPERATOR" NUMBER(10,0),*
    *     "MININTERCEPT" FLOAT(126),*
    *     "PRIORITY" NUMBER(10,0),*
    *     "PENALTY" NUMBER(10,0),*
    *     "STATUS" NUMBER(10,0),*
    *     PRIMARY KEY ("ID")*
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"  ENABLE,
    *) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING*
    STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"
    CREATE TABLE "MYUSER"."TABLE_CHILD"
    *(     "ID" NUMBER(19,0) NOT NULL ENABLE,*
    *     "WEIGHT" NUMBER(19,0),*
    *     "PARENTID_FK" NUMBER(19,0),*
    *     PRIMARY KEY ("ID")*
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"  ENABLE,
    *     CONSTRAINT "FK3A78BF1E6A9DCE51" FOREIGN KEY ("PARENTID_FK")*
    *     REFERENCES "MYUSER"."TABLE_PARENT" ("ID") ENABLE*
    *) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING*
    STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"
    - The Stored procedure definition is-
    CREATE OR REPLACE PROCEDURE LOAD_RULES_SP AS
    ruleid NUMBER(19,0);
    tempid NUMBER(19,0);
    BEGIN
    */* First parent record */*
    SELECT IDGENERATOR.NEXTVAL INTO ruleid FROM dual;
    INSERT INTO TABLE_PARENT (ID, NAME, DESCRIPTION, RULETYPE, OPERATOR, MININTERCEPT, PRIORITY, penalty, STATUS) VALUES (ruleid, 'Rule 1',null,3,0,0,null,null,1);
    */* Corresponding child records */*
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.2, ruleid);
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.5, ruleid);
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.3, ruleid);
    */* First parent record */*
    SELECT IDGENERATOR.NEXTVAL INTO ruleid FROM dual;
    INSERT INTO TABLE_PARENT (ID, NAME, DESCRIPTION, RULETYPE, OPERATOR, MININTERCEPT, PRIORITY, penalty, STATUS) VALUES (ruleid, 'Rule 1',null,3,0,0,null,null,1);
    */* Corresponding child records */*
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.2, ruleid);
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.5, ruleid);
    SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
    INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
    VALUES (tempid, 0.3, ruleid);
    */* And so on for a few parent records more */*
    END;
    Can you throw some light on the exception I was seeing now? Note that when I changed from stored procedure to an anonymous block, it worked fine.
    One correction in my earlier post is that as the code snippet shows, there are multiple inserts in the child table for every record inserted in the parent one.

  • RFC call from MSSQL 2000 stored procedure

    Hi. I need call SAP RFC transaction from stored procedure of MS SQL Server 2000.
    When i'm execute example from T-SQL Help it's work perfect
    Examples
    A. Use Prog ID
    This example creates a SQL-DMO SQLServer object by using its ProgID.
    DECLARE @object int
    DECLARE @hr int
    DECLARE @src varchar(255), @desc varchar(255)
    EXEC @hr = sp_OACreate 'SQLDMO.SQLServer', @object OUT
    IF @hr <> 0
    BEGIN
       EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
       SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
        RETURN
    END
    When i'm execute:
    DECLARE @object int
    DECLARE @hr int
    DECLARE @src varchar(255), @desc varchar(255)
    EXEC @hr = sp_OACreate 'SAP.Functions',
        @object OUT
    IF @hr <> 0
    BEGIN
       EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
       SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
        RETURN
    END
    i'm recieve error:
    0x800401F3
    ODSOLE Extended Procedure
    Wrong string with class name
    BUT! This example work perfect via another way: in VBS script, in VBA macros, in Visual FoxPro program.
    What wrong in MS SQL ???

    Hi Vitaly Ashmarin.
    Pls, Did you solve this issue?
    Ty

  • Stored Procedure to INSERT VALUE to UDT

    Hello Everyone,
          I came across a situation that I have UDT "Temp", when I enter data in AP Invoice, is there any way to exactly replicate the detail line data in to UDT, Can it be done using Transaction Notification Stored Procedure?? the UDT "Temp" have same columns as of PCH1 with same data type.
    Is it possible?? If so then please provide me the query to insert it in "Temp"..
    Which SP I have to use then?? and please provide me query..
    Thanks in advance

    Hi Idrees,
    if you Had made the UDT using SAP then please don't go for the Transaction Notification ... but if you have Created the table In Sql Server (Non-SAP Table  ) the Go for The Transaction Notification
    but if you  use UDT then "SAPbobsCOM.oUserTable" Go for It make Insert /Update/Delete Through it.
    Transaction Notification may be difficult to Handle.
      Regards,
    Mayank Shah.

  • Stored procedure with select return multiple rows

    hi,
    in transact the stored procedure is . .
    CREATE PROCEDURE MIPROCEDIMIENTO @CODE INT AS
    BEGIN
    SELECT COD, NAME, LASTNAME FROM EMPLOYE WHER COD = @CODE;
    END
    in oracle how?
    please, i speak spanish. .
    thanks

    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10767/procedures_plsql.htm#TDPNG60035
    Sybrand Bakker
    Senior Oracle DBA

  • Converting Sybase Stored procedures

    Our team has looked at the conv72.exe add-on that converts
    Sybase Transact Sql stored procedures to PL/SQL stored
    procedures (packages). We like many aspects of the tool, but
    the output does not meet with our coding standards and
    conventions. We would still have to completely reformat and
    rename about 1/2 of the output. This would take almost as much
    time as converting the procedures manually. Is there any way
    that we can modify how the output is presented? i.e. Has anyone
    written any tools that reformat the output of this tool, or is
    there anyway that we can have access to the source code so that
    we can change how the output is formatted. Our team is familiar
    with virtually every programming environment, so we would not be
    looking for any support if we were to get the source code.
    null

    Julie,
    We would be very interested in looking at your coding standards
    to see if there is something we should do with our new Sybase
    plugin to the Migration Workbench to improve the quality of
    PLSQL code generated.
    If you would be interested in following up on this please
    drop an email to the Workbench helpdesk, infomwb@ie oracle.com,
    and we will discuss further.
    We are always looking to improve the Workbench and if there
    is something that we can do to help address this issue we
    would be very interested in persuing it.
    Regards,
    Marie
    ===
    Julie Allen (guest) wrote:
    : Our team has looked at the conv72.exe add-on that converts
    : Sybase Transact Sql stored procedures to PL/SQL stored
    : procedures (packages). We like many aspects of the tool, but
    : the output does not meet with our coding standards and
    : conventions. We would still have to completely reformat and
    : rename about 1/2 of the output. This would take almost as much
    : time as converting the procedures manually. Is there any way
    : that we can modify how the output is presented? i.e. Has
    anyone
    : written any tools that reformat the output of this tool, or is
    : there anyway that we can have access to the source code so that
    : we can change how the output is formatted. Our team is familiar
    : with virtually every programming environment, so we would not
    be
    : looking for any support if we were to get the source code.
    Oracle Technology Network
    http://technet.oracle.com
    null

  • Crystal Designer is not recognizing CLR based Stored Procedures

    I am using Cystal Developer XI R2 and connecting to a SQL Database.  In that SQL Database I have created a CLR based Stored Procedure.  I notice that the Crystal Designer (at least by default) does not recognize stored procedures that are CLR based. 
    My first guess is the reason for this is that the xtype value (from sysobjects table) on this type of procedure is 'PC' instead of the normal 'P' for procedures.  Is it possible the designer is only listing objects where xtype is 'P'?
    Is there any way to fix this?
    Any help is greatly appreciated.
    Edited by: Ratinator on Oct 30, 2010 12:21 AM

    My workaround for the time being is to create a normal Transact SQL stored procedure which calls the CLR based stored procedure.

  • Transaction Issue while calling a stored procedure in osb

    HI all ,
    I have created a wrapper  procedure to call "soa.delete_instances (this procedure will delete the instances from SOA_INFRA schema)" oy locall created user schema(ASG).
    If i execute  the wrapper procedure direclt in SqlDeveloper it's working fine cleaning the instances.
    i have called this procedure in OSB by using the DB adaptor JCA file, the wrapper procedure is executing fine, but not deleting instances from the SOA_INFRA schema.
    any help is apriciated.
    Thanks..

    Maaan, there could be so many reasons for that... just some things to check:
    1. How do you know the stored procedure executes fine? If you didn't get a failure response from a call to JCA, that means nothing.
    2. Do you log the procedure step by step? Did it reach its normal completion? How many rows (it believes) it found/deleted?
    3. What user is the stored procedure executed under from OSB (obviously -- user of the datasource)? Does this user have rights to see/delete those records?
    4. Are you executing the proxy in transaction, and if yes, didn't you get an error that rolled back that transaction?
    and so on, and so forth.
    Vlad
    http://vladimirdyuzhev.com

  • Stored procedure in a transaction problem

    hello to everybody
    I have an application under weblogic8.1 sp3.
    I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
    ORA-02089: COMMIT is not allowed in a subordinate session
    Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...

    giorgio giustiniani wrote:
    hello to everybody
    I have an application under weblogic8.1 sp3.
    I have to call an Oracle stored procedure that populate a table and I have to see the new record anly at the end of the ejb service transaction ( a Container transaction ).When the procedure terminate I see the db data before the transaction end.So I have created a XA DataSource and changed the oracle 9.2 thin drivers in oracle 9.2 thin drivers XA.But Now I receive this Oracle Error:
    ORA-02089: COMMIT is not allowed in a subordinate session
    Why?How Can I resolve my problem?Can Anyone Help Me?Thanks...It sounds like you have transactional syntax embedded in your
    procedure. You can't do that and still include it in an XA
    transaction.
    Joe

  • WL 6.0 using MS SQL Server 2000 - Transaction timeout when invoking stored procedure

    Hi,
    Facing a problem on WL6.0. We are connecting to MS SQL server 2000 using a stateless
    session bean
    using container managed transaction. The bean method does a few updates to the
    database and also
    calls a stored procedure that generates primary keys many times. This stored procedure
    (SP) is running
    in a transaction of its own since it has to increment a counter, update the database
    and then return the
    primary key.The primary key generator SP is working fine and does not lock the
    database in many bean
    methods.
    In some methods we find that the primary key generator SP has locked the database.
    We
    then see a lock on the database created due to this SP in the MS SQL client. The
    execution goes
    into the SP and gets stuck there till the bean's transaction times out. The error
    message given is
    ...... .. Exception Message - The transaction is no longer active
    (status = Rolling Back. [Reason = weblogic.transaction.internal.TimedOutExcepti
    on: Transaction timed out after 31seconds
    tx = transaction=(IdHash=1746718,Name = [EJB StructMgrBeanImpl.addStructure()],X
    id=10908:51e67e9d7185816a,Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=
    0,seconds since begin=31,seconds left=30,activeThread=Thread[ExecuteThread: '7'
    for queue: 'default',5,Thread Group for Queue: 'default'],ServerResourceInfo[web
    logic.jdbc.jts.Connection]=(state=started,assigned=none),SCInfo[myserver]=(state
    =active),properties=({weblogic.transaction.name=[EJB StructMgrBeanImpl.addStruct
    ure()], weblogic.jdbc=t3://10.200.15.136:7001}))]). No further JDBC access is
    al
    lowed within this transaction.
    What could be the potential problems in the method's code/SP that could be causing
    the timeout?
    Anyone faced similar problems?
    Thanks in advance,
    Sreeja

    Hi,
    Facing a problem on WL6.0. We are connecting to MS SQL server 2000 using a stateless
    session bean
    using container managed transaction. The bean method does a few updates to the
    database and also
    calls a stored procedure that generates primary keys many times. This stored procedure
    (SP) is running
    in a transaction of its own since it has to increment a counter, update the database
    and then return the
    primary key.The primary key generator SP is working fine and does not lock the
    database in many bean
    methods.
    In some methods we find that the primary key generator SP has locked the database.
    We
    then see a lock on the database created due to this SP in the MS SQL client. The
    execution goes
    into the SP and gets stuck there till the bean's transaction times out. The error
    message given is
    ...... .. Exception Message - The transaction is no longer active
    (status = Rolling Back. [Reason = weblogic.transaction.internal.TimedOutExcepti
    on: Transaction timed out after 31seconds
    tx = transaction=(IdHash=1746718,Name = [EJB StructMgrBeanImpl.addStructure()],X
    id=10908:51e67e9d7185816a,Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=
    0,seconds since begin=31,seconds left=30,activeThread=Thread[ExecuteThread: '7'
    for queue: 'default',5,Thread Group for Queue: 'default'],ServerResourceInfo[web
    logic.jdbc.jts.Connection]=(state=started,assigned=none),SCInfo[myserver]=(state
    =active),properties=({weblogic.transaction.name=[EJB StructMgrBeanImpl.addStruct
    ure()], weblogic.jdbc=t3://10.200.15.136:7001}))]). No further JDBC access is
    al
    lowed within this transaction.
    What could be the potential problems in the method's code/SP that could be causing
    the timeout?
    Anyone faced similar problems?
    Thanks in advance,
    Sreeja

  • Setting transaction isolation level on a replicated server stored procedure

    I have a SQL server that has replication turned onto to another server which is our reporting server. Replication is real-time (or close to it). On the report server I have a stored procedure that runs from a SRS report. My question is it possible or advisable
    or does it even make sense to set the "SET TRANSACTION ISOLATION LEVEL READ COMMITTED" on at the beginning of the stored procedure which selects data from the reporting server database? Is it possible for uncommitted data on the OLTP side of the
    house to be replicated before it is committed? We are having data issues with a report and have exhausted all options and was wondering if dirty data maybe the issue since the same parameters work for a report 1 sec and then next it doesnt.

    Only committed transactions are replicated to the subscriber.  But it is possible for the report to see dirty data if running in READ UNCOMMITTED or NOLOCK.  You should run your reports in READ COMMITTED or SNAPSHOT isolation , and your replication
    subscriber should be configured with READ COMMITTED SNAPSHOT ISLOATION eg
    alter database MySubscriber set allow_snapshot_isolation on;
    alter database MySubscriber set read_committed_snapshot on;
    as recommended here
    Enhance General Replication Performance.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • JDO transaction, caching and stored procedures

    I currently retreive an existing object, update the object, and then call
    a stored procedure - all in one transaction. The issue I am running into
    is that the stored proc must have the modified data available when it
    selects the row (modified object) from the table. This is currently not
    happening. For example, if the initial field was null, then it is updated
    and the proc called, the proc only sees null. How do I specify that the
    changes should be processed w/in the transaction (not commited) and
    available for other processes reading the data in the same tx?
    Note: everything works perfect if I manually execute the update statement
    through a Statement on the connection for the stored proc. I have tried
    flush().
    Any ideas would be greatly appreciated!

    Here is a dumbed down version... I also tried doing a Query with JDO and
    that returns the modified value. Basically, the code below find the
    existing object, modifies a field, and then calls a stored proc to do some
    processing. Unfortunately, the stored proc needs to be able to "see" the
    modified data in the transaction.
    public void modifyFoo( UserToken userToken,
    Foo newFoo,
    Integer applicationId )
    PersistenceManager pm = null;
    Transaction tx = null;
    Integer applicationId = producerApplication.getId();
    try
    pm = JDOFactory.getPersistenceManager( userToken );
    tx = pm.currentTransaction();
    tx.begin();
    FooBoId appId = new FooBoId();
    appId.fooBolId = applicationId;
    FooBo appDbVo = (FooBo)pm.getObjectById( appId, true );
    appDbVo.setEffectiveDate( newFoo.getEffectiveDate() );
    String fooNumber = executeFooBar( userToken, applicationId
    appDbVo.setFooNumber( fooNumber );
    tx.commit();
    private String executeFooBar( UserToken userToken, Integer
    applicationId )
    throws PulsarSystemException, ValidationException
    String licenseNumber = null;
    try
    // Get a connection from the persistence manager
    Connection connection = JDOFactory.getConnection( userToken );
    connection.setAutoCommit( false );
    CallableStatement cs = connection.prepareCall( "{call
    sys_appl_pkg.fooBar(?,?,?,?,?,?)}" );
    // Register the type of the return value
    cs.registerOutParameter( 4, Types.NUMERIC );
    cs.registerOutParameter( 5, Types.NUMERIC );
    cs.registerOutParameter( 6, Types.VARCHAR );
    // Set parameters:
    cs.setString( 1, "Test" );
    cs.setInt( 2, applicationId.intValue() );
    cs.setInt( 3, 0 );
    catch( SQLException ex )
    ex.printStackTrace();
    return licenseNumber;
    Patrick Linskey wrote:
    Can you post the code that you're executing?
    -Patrick
    On Mon, 14 Jul 2003 20:38:09 +0000, Josh Zook wrote:
    I currently retreive an existing object, update the object, and then call
    a stored procedure - all in one transaction. The issue I am running into
    is that the stored proc must have the modified data available when it
    selects the row (modified object) from the table. This is currently not
    happening. For example, if the initial field was null, then it is updated
    and the proc called, the proc only sees null. How do I specify that the
    changes should be processed w/in the transaction (not commited) and
    available for other processes reading the data in the same tx?
    Note: everything works perfect if I manually execute the update statement
    through a Statement on the connection for the stored proc. I have tried
    flush().
    Any ideas would be greatly appreciated!
    Patrick Linskey
    SolarMetric Inc.

  • Transaction Handling via Multiple Stored Procedure Calls

    Hello,
    we have the requirement that we call severall stored procedures in a sequence. The problem now is to have one explicit transaction which is only commited in case all calls have been succesful. In case there is an error during one of the calls all already executed stored procedures should be rolled back.
    One idea would be to define transactional behavior in BPM within a block but I have some doubts whether this works as I have found the following warning in the SAP XI help section:
    "The transaction control mechanism for integration processes is not a central transaction manager for an entire system landscape. The transaction control mechanism cannot roll back any processing steps outside the Integration Server"
    Do you have any advice on this issue?
    Thanks a lot!

    The best solution would be to call the root SP from XI adaptor and handle the transaction commit logic in side this root SP. That way even BPM will not be in picture.
    BPM can not handle transaction roll back on external systems.
    VJ

Maybe you are looking for

  • On mac here 10.5.8

    Hello does anyone know if I can use my phone on the Mac here for updates and back up thanks ? my unit wont go higher I asked my teck guys for mac.  Thanks for replies I will get back to you asap.

  • CS 5.5 (Mac) Update Issues

    I've been stuck on Dreamwever CS 5.5 Build 5366 (v 11.5.1.5366) for well over a year now and none of my other CS products (Photoshop, Flash Builder, Fireworks, Illustrator, etc.) have been updating.  It seems that when the updater updated itself (cur

  • Buttons created with edge animate are not working on android and windows devices

    Hello, I created a moble version of my website with edge animate (3.0). The menue-bars/buttons work fine with iphone and ipad, but not with android and windows devices. http://www.design-werk.org/buchgestaltung_kunstbuch.html Does anyone have an idea

  • Init deletion problem...cannot find request

    Hi all, I have a problem with finding the init request. when i activate my chains it asks me to delete the init request. But I cannot find the init request. I use transaction RSRQ to find the request...it takes me to the monitor and shows me that the

  • No enclosing instance of the type AClass is accessible in scope

    Hi all, Below is a file that defines AClass and CClass. I was told to use the construction CClass toRet = (CClass) AClass.this.createDClass(); in method method in CClass, but I can't get it to work. I get the message "No enclosing instance of the typ