Please help me on BT/ET and ROLLBACK/ABORT

Database

Please help me on BT/ET and ROLLBACK/ABORT

HI all,

I am a new bee in TD and I am facing an issue. The details are given below.

I am trying the below query, here I am trying to INSERT rows into a table and ROLLBACK...

BT;INSERT INTO TABLEA SELECT COL1,COL2,COL3 from TABLEB; ET;ROLLBACK;

while executing the above query I am getting the below error. Please help me on this.......

TRANSACTION Command Complete

315 rows processed.

INSERT Command Complete

ERROR [HY008] [Teradata][ODBC Teradata Driver][Teradata Database] User-generated transaction ABORT.

ROLLBACK Command Failed.

 

Tags (1)
3 REPLIES
Junior Contributor

Re: Please help me on BT/ET and ROLLBACK/ABORT

You should commit a transaction only when you're shure you don't need a rollback :-)

There's an ET before the ROLLBACK.

Dieter

Supporter

Re: Please help me on BT/ET and ROLLBACK/ABORT

Hm,

what you do is

1. Begin a transaction

2. Ins/select - at the end of the Ins/Select the transaction is still open.

3. End the transaction (Insert / Select is commited)

4. Rollback - What do you expect to be rolled back after the ET?

Rollback is mainly used within a transaction with some conditional logic.

So whats your intention?

Re: Please help me on BT/ET and ROLLBACK/ABORT

Thank you for reply's...

Yes, I forget to add the condition, I am inserting the data into TABLEA using my control table status. If I am using an conditional statement could you please provide the syntax for rollbacking the transaction..