云数据库 GAUSSDB-RELEASE SAVEPOINT:示例
时间:2025-03-03 09:51:15
示例
--创建SCHEMA。 openGauss=# CREATE SCHEMA tpcds; --创建一个新表。 openGauss=# CREATE TABLE tpcds.table1(a int); --开启事务。 openGauss=# START TRANSACTION; --插入数据。 openGauss=# INSERT INTO tpcds.table1 VALUES (3); --建立保存点。 openGauss=# SAVEPOINT my_savepoint; --插入数据。 openGauss=# INSERT INTO tpcds.table1 VALUES (4); --删除保存点。 openGauss=# RELEASE SAVEPOINT my_savepoint; --提交事务。 openGauss=# COMMIT; --查询表的内容,会同时看到3和4。 openGauss=# SELECT * FROM tpcds.table1; --删除表。 openGauss=# DROP TABLE tpcds.table1; --删除SCHEMA。 openGauss=# DROP SCHEMA tpcds CASCADE;
support.huaweicloud.com/centralized-devg-v2-gaussdb/gaussdb_42_0488.html