Adaptive Server 15.0.2 introduces user-defined SQL functions.
Use create function to create user-defined functions, and drop function to remove a user-defined function.
declare statements to define data variables and cursors that are local to the function.
Assigned values to objects local to the function (for example, assigning values to scalar and variables local to a table with select or set commands).
Cursor operations that reference local cursors that are declared, opened, closed, and deallocated in the function.
Control-of-flow statements.
set options (only valid in the scope of the function).
You can include select or fetch statements that assign values only to local variable.