Hi,
We have a scenario where based on a case statement we need to 'ROLLBACK TO SAVEPOINT' or error out and not do a commit. This is to avoid delete statement when reconciliation check fails. As of now we are handling as below:
select
case when currency1 = currency2 then 1
else
currency1/0
end
from temp1;
We are adding a DIVISION BY ZERO check to force exit and not do a COMMIT. But adding this makes it difficult to distinguish between actual DIVISION BY ZERO error and the forced error. Kindly provide inputs If there is a way to exit or break in Vertica.
Thank You
GOTO or EXIT or BREAK in Vertica
Moderator: NorbertKrupa
-
- GURU
- Posts: 527
- Joined: Tue Oct 22, 2013 9:36 pm
- Location: Chicago, IL
- Contact:
Re: GOTO or EXIT or BREAK in Vertica
You can try casting to a float:
Code: Select all
...
currency1::float/0
...
Checkout vertica.tips for more Vertica resources.
Re: GOTO or EXIT or BREAK in Vertica
Thanks for the response. By adding cast error, it might get difficult to debug when there is an actual cast error. Is there a way to throw 'File Not Found' error or any rare errors.