cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to "skip" to the end of the Stored Procedure instead of running the entire procedure?

pressfit
Participant
0 Kudos

We have created a really long procedure which runs 100+ checks on a transaction. It is of the following form:

if check1
then error_message := 'Error 1';
end if;

if check2
then error_message := 'Error 2';
end if;

However, I want to optimize the execution of these checks. Right now, even if check1 fails, the procedure executes all of the remaining checks. Can we write a "Go to End" sort of code which can simply end skip ahead to the end of the procedure if it encounters an error? E.g.

if check1
then error_message := 'Error 1';
go to <end>
end if;

if check2
then error_message := 'Error 2';
go to <end>
end if;

former_member358098
Participant
0 Kudos

not sure if i understood you correctly, but i would do it by creating for-loop with condition it would go only 1 time, and inside each if i would use break;

Accepted Solutions (0)

Answers (1)

Answers (1)

pfefferf
Active Contributor
0 Kudos

One opton would be to declare an exit handler and raise a user-defined exception when a condition is not fulfilled.