Transactions in the Oracle database : Add, modify, and delete transactions are required (show transactions).
1. The classification of transactions shows transactions (add, modify, delete) and implicit transactions (except additions, modifications, deletions).
2. How transactions are performed: Auto-commit (JDBC) or manual commit.
When adding, modifying, deleting, do you need to write a commit;
3. Application of transactions: When an operation corresponds to multiple additions, modifications, and deletions, it is necessary to maintain the consistency of the data through transaction processing.
The commit of the transaction and the rollback of the thing.
1 -to achieve the effect of bank transfer, commit to show things to do, update to database 2 Update jsb_test set money=money+300 where id=1; 3 Update jsb_test set money=money-300 where id=2; 4 commit;
1 Declare2 V_error exception;3PRAGMA Exception_init (v_error,-2290);4 begin5Update jsb_test set money=money+300 where id=1;6Update jsb_test set money=money-300 where id=2;7 commit;8Dbms_output.put_line (' Transfer success ');9 ExceptionTen When V_error then OneRollback--Things roll back ADbms_output.put_line (' Transfer failed '); -End