GOTO or EXIT or BREAK in Vertica

Moderator: NorbertKrupa

Post Reply
sarithats
Newbie
Newbie
Posts: 5
Joined: Wed Sep 09, 2015 7:10 am

GOTO or EXIT or BREAK in Vertica

Post by sarithats » Wed Nov 18, 2015 11:31 am

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

NorbertKrupa
GURU
GURU
Posts: 527
Joined: Tue Oct 22, 2013 9:36 pm
Location: Chicago, IL
Contact:

Re: GOTO or EXIT or BREAK in Vertica

Post by NorbertKrupa » Wed Nov 18, 2015 11:45 pm

You can try casting to a float:

Code: Select all

...
currency1::float/0
...
Checkout vertica.tips for more Vertica resources.

sarithats
Newbie
Newbie
Posts: 5
Joined: Wed Sep 09, 2015 7:10 am

Re: GOTO or EXIT or BREAK in Vertica

Post by sarithats » Tue Nov 24, 2015 10:58 am

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.

Post Reply

Return to “General”