0

I got that message bellow :

A savepoint cannot be set because a savepoint already exists and nested savepoints are not supported.

I'm doing that query :

 P3: BEGIN ATOMIC 

         INSERT INTO GPRSD001.COOP(
              --  CCOOP,
                NDOCTO,
                ICOOP)
            VALUES (
                --ps_iPkCooperativa,
                v_xDocumentoCooperativa,
                v_xNomeCooperativa);
           COMMIT ;
            SIGNAL SQLSTATE '02000';
              rollback ;
        --EXCEPTION
         --   WHEN OTHERS THEN
        --  ROLLBACK;
           --   RAISE_APPLICATION_ERROR(-20101, (' GPRS6002 - ERRO: ' || SQLERRM || ' - ' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE));
        END; -->> Fim - Inserindo cooperativa <<--

How do i get rid of it ? That error , its related with SavePoint right ?

Luiz
  • 141
  • 2
  • 14
  • 2
    How is this both `Oracle` and `DB2`? What is the rest of the code, where the other savepoint has been created? – MatBailie Dec 19 '17 at 13:47
  • Acctually i didnt created savepoint on it . Im migrating Oracle scripts to DB2 . This is Oracle Script `BEGIN INSERT INTO COOP( CCOOP, NDOCTO, ICOOP) VALUES ( ps_iPkCooperativa , v_xDocumentoCooperativa, v_xNomeCooperativa); COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK; RAISE_APPLICATION_ERROR(-20101, (' GPRS6002 - ERRO: ' || SQLERRM || ' - ' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE));` – Luiz Dec 19 '17 at 13:53
  • And i have to Commit in DB2 , but i dunno how can i see which savepoints were created on DB2 and also see which savepoint has been creating. Looking in my code , i didnt see anything reffer to savepoint or something like that. – Luiz Dec 19 '17 at 13:55
  • The savepoint is related to Transactions. You have a transaction sitting open already, or you have other code not shown that created a transaction, or something similar. – MatBailie Dec 19 '17 at 13:57
  • Edit your question to specify your Db2-version and the operating-system that runs your Db2-server. You should always give those details because they can determine the answer. – mao Dec 19 '17 at 13:58
  • Matt I created a new savepoint and I related rollback to new save boint has been created . It works .. i dunno how but works. I'll do some test to see how actually Savepoints Works . Thanks Anyway for you help . Have a good one . – Luiz Dec 19 '17 at 14:09

0 Answers0