Difference between revisions of "COMMIT"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
==Class== | ==Class== | ||
SQL Applications | SQL Applications | ||
Line 21: | Line 18: | ||
The COMMIT statement ends the current or specified transaction and any transactions that are nested within it and makes permanent all changes performed in the transaction or transactions. | The COMMIT statement ends the current or specified transaction and any transactions that are nested within it and makes permanent all changes performed in the transaction or transactions. | ||
− | TRANSACTION <transaction> | + | ====TRANSACTION <transaction>==== |
The optional TRANSACTION <transaction> is used to specify the name of the transaction to be committed. | The optional TRANSACTION <transaction> is used to specify the name of the transaction to be committed. | ||
− | WORK | + | ====WORK==== |
The optional WORK keyword is included for SQL ANSI 92 compatibility. COMMIT WORK and COMMIT operate in the same way. | The optional WORK keyword is included for SQL ANSI 92 compatibility. COMMIT WORK and COMMIT operate in the same way. | ||
Line 39: | Line 36: | ||
// Transactions | // Transactions | ||
BEGIN TRANSACTION trans1; | BEGIN TRANSACTION trans1; | ||
− | INSERT INTO customer | + | INSERT INTO customer |
− | (TITLE, LAST_NAME, FIRST_NAME, INITIAL, STREET, | + | (TITLE, LAST_NAME, FIRST_NAME, INITIAL, STREET, |
− | CITY, STATE, ZIP,LIMIT, START_DATE) | + | CITY, STATE, ZIP,LIMIT, START_DATE) |
− | VALUES | + | VALUES |
− | ('Ms', 'Jones', 'Susan', 'B', '177 High Street','Beverly', 'MA', '01915', 2000, date()); | + | ('Ms', 'Jones', 'Susan', 'B', '177 High Street','Beverly', 'MA', '01915', 2000, date()); |
− | INSERT INTO accounts (ORD_VALUE) VALUES (30); | + | INSERT INTO accounts (ORD_VALUE) VALUES (30); |
− | // Commit the trans1 transaction | + | // Commit the trans1 transaction |
− | COMMIT TRANSACTION trans1; | + | COMMIT TRANSACTION trans1; |
END TRANSACTION; | END TRANSACTION; | ||
// End of program | // End of program |
Revision as of 15:56, 27 April 2009
Contents
Class
SQL Applications
Purpose
Ends the current transaction, saving changes
Syntax
COMMIT [TRANSACTION <transaction>] [WORK]
See Also
BEGIN TRANSACTION, END TRANSACTION, ROLLBACK, SAVE TRANSACTION, SAVEPOINT, SET TRANSACTION, TXNISOLATION(), TXNLEVEL()
Description
The COMMIT statement ends the current or specified transaction and any transactions that are nested within it and makes permanent all changes performed in the transaction or transactions.
TRANSACTION <transaction>
The optional TRANSACTION <transaction> is used to specify the name of the transaction to be committed.
WORK
The optional WORK keyword is included for SQL ANSI 92 compatibility. COMMIT WORK and COMMIT operate in the same way.
A transaction is a sequence of SQL statements that Recital treats as a single unit. A transaction begins with the first executable SQL statement after a BEGIN TRANSACTION. A transaction ends with a COMMIT, ROLLBACK or END TRANSACTION.
Example
// config.db set sql to recital set sql on // end of config.db // Transactions BEGIN TRANSACTION trans1; INSERT INTO customer (TITLE, LAST_NAME, FIRST_NAME, INITIAL, STREET, CITY, STATE, ZIP,LIMIT, START_DATE) VALUES ('Ms', 'Jones', 'Susan', 'B', '177 High Street','Beverly', 'MA', '01915', 2000, date()); INSERT INTO accounts (ORD_VALUE) VALUES (30); // Commit the trans1 transaction COMMIT TRANSACTION trans1; END TRANSACTION; // End of program
Products
Recital Database Server, Recital Mirage Server, Recital Terminal Developer