Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Overview

Non-AutoCommit mode is set as default of Oracle Commit-Mode. 

Whereas in case of Altibase, AutoCommit mode is set as default.
Then, If you want to control a transaction, you have to change a commit-mode.

Note

Commit-mode is defined in $ALTIBASE_HOME/conf/altibase.properties (default: AUTO_COMMIT = 1)

ORACLE

Sample code

Code Block
c
c
...
EXEC SQL SAVEPOINT point1;
EXEC SQL INSERT INTO employee (NAME, AGE) VALUES ('park',  40);
...
EXEC SQL SAVEPOINT point2;
EXEC SQL UPDATE employee SET age = 41 WHERE name = 'park';
...
EXEC SQL COMMIT;

ALTIBASE

Code Block
c
c
...
EXEC SQL SAVEPOINT point1;
EXEC SQL INSERT INTO employee (NAME, AGE) VALUES ('park',  40);
...
EXEC SQL SAVEPOINT point2;
EXEC SQL UPDATE employee SET age = 41 WHERE name = 'park';
...
EXEC SQL ROLLBACK TO SAVEPOINT point2;
EXEC SQL COMMIT;
  • When a transaction is commited or rollbacked in ALTIBASE HDB, Already open cursor should be closed.
    (Currently, fetch across commit Functionality is not supported, It will be supported at Version 7)
  • APRE doesn't support a functionality of "WITH HOLD" of cursor.
  • APRE doesn't support a functionality of "CLOSE_ON_COMMIT" of pro*c option.
  • SELECT ~ FOR UPDATE
    Code Block
    c
    c
    EXEC SQL SELECT sal FROM salary FOR UPDATE;
    
    • If you use "FOR UPDATE" clause, You cannot reference multiple tables.
    • "FOR UPDATE" clause acquires a exclusive row locks. Therefore, you have to use it in Non-AutoCommit mode.

How to change commit-mode

ALTIBASE HDB is basically running on AUTO-COMMIT mode.
If you want to change COMMIT-MODE, you can do as follows.

Code Block
c
c
...
EXEC SQL AUTOCOMMIT ON;
EXEC SQL AUTOCOMMIT OFF;
EXEC SQL ALTER SESSION SET AUTOCOMMIT = TRUE;
EXEC SQL ALTER SESSION SET AUTOCOMMIT = FALSE;