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,053

Hello Experts,

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

Thanks and Regards,

Arpita

View Entire Topic
RichHeilman
Developer Advocate
Developer Advocate

I've just tested this in a Rev61 system, and the RETURN statement works just fine for this.

CREATE PROCEDURE test_return ( in im_flag nvarchar(1))

          LANGUAGE SQLSCRIPT

          SQL SECURITY INVOKER

          --DEFAULT SCHEMA <default_schema_name>

          READS SQL DATA AS

BEGIN

/*****************************

          Write your procedure logic

*****************************/

  select 'This' from dummy;

select 'That' from dummy;

if :im_flag = 'Y' THEN

  RETURN;

end if;

select 'The Other' from dummy;

END;

Cheers,

Rich Heilman