Subroutines

Top  Previous  Next

You can define local subroutines in each scripting block. These routines can then be called as you would do with regular routines.

 

Both local functions (routines that return a value) and local procedures (routines that return nothing) are supported.

 

Declaring these routines should be done before the first BEGIN in the scripting block.

 

execute udsblock(intin1 integer, vcin1 varchar(200))

returns(o1 integer, o2 varchar(200))

as

 

 declare function mult(i1 integer, i2 integer) returns integer

 as 

 declare variable b boolean = false;

 begin

   begin

     i1 = i1 * 2;

   end

   return i1 * i2;

 end

 

declare myint integer;

 

begin

  o1 = intin1 * intin1;

  o1 = mult(intin1, 4);

  o2 = vcin1;

end

 

See Also

DECLARE FUNCTION
DECLARE PROCEDURE