cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Exit command in SQL script

arpitasethi
Product and Topic Expert
Product and Topic Expert
0 Likes
6,065

Hello Experts,

Is there an 'Exit' like command in SQL script (for script based calculation view)?

Thanks and Regards,

Arpita

View Entire Topic
Ravi_Channe
Active Contributor
0 Likes

Hi Arpita,

I don't think there is any EXIT as such, but if you are using LOOPS (WHILE or IF) with a condition, then you can always make the condition false for the loop to complete.

For ex: if you have while loop with

   WHILE v_val < 50 DO

   END WHILE;

In the loop you can always set the v_val to 50 when you want to exit the loop.

Is this what you are looking for or is there something else.

Regards,

Ravi

arpitasethi
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Ravi,

I wanted something like -

If x is null then

exit;

end if;

Ofcourse, I can put my code in the other condition for if, if there is no exit.

I just wanted to keep it clean.

Anyway, thanks for the input!

Regards,

Arpita

Former Member
0 Likes

Just to add there are BREAK & CONTINUE statements that you could use to exit from loops - page 43 in http://help.sap.com/hana/hana_dev_sqlscript_en.pdf

Thanks,

Anooj

Ravi_Channe
Active Contributor
0 Likes

Hi Anooj,

Welcome back.. . Missed your expert comments last few days.

Regards,

Ravi

Former Member
0 Likes

Thanks Ravi Hope you doing well!