Vertica transactions

GoldengateGoldengate Community Edition User
edited March 2023 in General Discussion

Hello guys, hope you're doing great!

I'm working with a SQL script on Dbeaver on Vertica 11.1 and I need to create a transaction with setting autocommit off and something like this:

BEGIN TRY
BEGIN TRANSACTION

    CREATE TABLE myTable (A INT NOT NULL, B VARCHAR(10),C  NUMERIC(10,2) NOT NULL)

    INSERT INTO myTable (myColumns ...) VALUES (myValues ...);
    INSERT INTO myTable (myColumns ...) VALUES (myValues ...);
    INSERT INTO myTable (myColumns ...) VALUES (myValues ...);

COMMIT TRAN  --DO IT NICELY!

END TRY
BEGIN CATCH
@TRANCOUNT > 0
-- ERROR ERROR ERROR ROLLBACK!!!!!!!!
ROLLBACK TRAN
END CATCH

Any ideas?

Regards

Fran

Best Answer

Answers

This discussion has been closed.