'Start Transaction' activity shows success even when inside components fail

Hello community;

I have a “TryCatch” block and inside of it two “Insert” activities. I need to extract the errors Oracle responds when, for example, a primary key is being violated. I am debugging the “TryCatch” block and the problem I see is that the “TryCatch” block never falls into the “Catch” part because even when one of the “Inserts” fails the “Start Transaction” block shows sucess.

Is there a way to circle arund this issue?

For information porposes:

Try:
Start Transaction:
Insert 1
Insert 2
Catch:
SQL. Exception capturing

Result: The try block is always succesfull because the “Star transaction” activity never fails.

Hi @Marce_L13

Can you try with this nested try catch structure

Try:
Start Transaction
Try:
Insert 1
Catch (Exception ex):
Handle Insert 1 Error (e.g., Log exception)
Try:
Insert 2
Catch (Exception ex):
Handle Insert 2 Error (e.g., Log exception)
End Transaction
Catch:
Handle General SQL Exceptions

Hope this helps :slight_smile:

@Marce_L13

Did you happen to set continue on error as true?

If so please set it to false

Cheers

I used this nesting design you provided but the result stays the same. The first “Insert” commits even when the second one fails. The only design that seems to work is when you put the two “Inserts” directly inside the “Star Transaction” activity, but in that case I cant “catch” the error, it only appears in the logs as an error in red, I need to capture it so I cant send it to the people that can work it out.

Hello Anil, the “Continue on error” is set to False.

@Marce_L13

Please set use transaction property to true

Cheers

Use transaction is already set to true.

@Marce_L13

When you say insert activity is failed do you means its throwing error?

Or is it like no rows are inserted and you are getting effected rows return value as 0

If it is that the return value is zero then that means insert is not failed but is not executed as expected …failure in this case is when insert activity throws an error

And ideally if use transaction is set to true then insert happens only when both are successful

Cheers

I will explain:

The first Insert block does ok (green tick)

This is the exception thrown by the second insert block (red warning sign). It even stays logged in the output.

Insert: ORA-20010: Acreedor 333333 no existe
ORA-06512: at “RECTOR.RPAG_EMISION_ATMZ_GRNIZO_DET_BIU”, line 71
ORA-04088: error during execution of trigger ‘RECTOR.RPAG_EMISION_ATMZ_GRNIZO_DET_BIU’

The “Start transaction activity” show green tick after this, so, it never falls into the “catch” block and I cant get the error messaged to store it into a variable. Is there at least a way to extract it from the log?

If needed, I could get a video, It baffles me what is happening.

@Marce_L13

Can you try changing the db activities version and chec
Because if one of the item inside set transaction fails then if use transactionnis set to true and continue on error is false then precious insert would not happen and error is caught

Please try changing the pckage version and check…if error persists please provide the versions you tried

Cheers

i am now starting to try with different versions of the UiPath.Database.Activities

Will report to you in a while, in the meantime I edited the first post so that what is happening can be seen.

Report of the troubleshooting with different versions:

  1. 1.7.0 | Start Transacton activity shows success even when one of the inserts fails
  2. 1.7.1 | Start Transacton activity shows success even when one of the inserts fails
  3. 1.9.0 | I get error ORA-28040. I cant modify the database so this would not be a viable option

I am starting to panic.

I would just change the logic of the code. Instead of running the transaction, I would suggest converting it into a stored procedure.

The Start Transacition activity provides subpar performance according to what the documentation say it does. None of the provided suggestions worked. Start Transaction activity should fail whenever one of the databade operations inside its scope fails, so that the errors that the database pops up can be captured.

The workaround I found was using the Global Exception Handler to capture the error and push it into the main workflow so I could save it into a variable and write a message.

Thanks to anyone who tried to help me, have a nice day.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.