ABORT
Description
Rolls back the current transaction and cancels the changes in the transaction.
It is equivalent to ROLLBACK, and is present only for historical reasons. Now ROLLBACK is recommended.
Precautions
ABORT has no impact outside a transaction, but will provoke a warning.
Syntax
1
|
ABORT [ WORK | TRANSACTION ] ; |
Parameters
WORK | TRANSACTION
Optional keyword has no effect except increasing readability.
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
-- Create the customer_demographics_t1 table. gaussdb=# CREATE TABLE customer_demographics_t1 ( CD_DEMO_SK INTEGER NOT NULL, CD_GENDER CHAR(1) , CD_MARITAL_STATUS CHAR(1) , CD_EDUCATION_STATUS CHAR(20) , CD_PURCHASE_ESTIMATE INTEGER , CD_CREDIT_RATING CHAR(10) , CD_DEP_COUNT INTEGER , CD_DEP_EMPLOYED_COUNT INTEGER , CD_DEP_COLLEGE_COUNT INTEGER ) DISTRIBUTE BY HASH (CD_DEMO_SK); -- Insert data. gaussdb=# INSERT INTO customer_demographics_t1 VALUES(1920801,'M', 'U', 'DOCTOR DEGREE', 200, 'GOOD', 1, 0,0); -- Start a transaction. gaussdb=# START TRANSACTION; -- Update the column. gaussdb=# UPDATE customer_demographics_t1 SET cd_education_status= 'Unknown'; -- Abort the transaction. All updates are rolled back. gaussdb=# ABORT; -- Query data. gaussdb=# SELECT * FROM customer_demographics_t1 WHERE cd_demo_sk = 1920801; cd_demo_sk | cd_gender | cd_marital_status | cd_education_status | cd_purchase_estimate | cd_credit_rating | cd_dep_count | cd_dep_employed_count | cd_dep_college_count ------------+-----------+-------------------+----------------------+----------------------+------------------+--------------+-----------------------+---------------------- 1920801 | M | U | DOCTOR DEGREE | 200 | GOOD | 1 | 0 | 0 (1 row) -- Delete the table. gaussdb=# DROP TABLE customer_demographics_t1; |
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot