Types of Stored Procedures
Stored procedures include functions and subroutines, which are defined below.
Function
An independent BASIC+ module that accepts arguments and returns a value to the calling process when it completes execution. A type of stored procedure. A function can be called by a subroutine, event handler, or another function.
Subroutine
An independent BASIC+ module that can be called from a stored procedure or from an event handler. A subroutine executes a process, but does not return a value to the calling process. A subroutine can modify the values of the arguments passed to it from the calling program.
Internal subroutine
A BASIC+ submodule that can be called from anywhere in a subroutine, function, or event handler, and exists as part of the subroutine, function, or event handler.
Given the above definition for a function, you may be thinking that an event handler is also a stored procedure. In one sense it is; the event handler is an independent BASIC+ module, stored in the repository as an entity. However, a key difference between an event handler and a function is that the event handler only exists as long as the form or window, control, or menu item to which it is tightly coupled exists. When the window, control, or menu item is deleted, all event handlers associated with that entity are also deleted. It is due to this dependency that event handlers are differentiated from stored procedures.
This chapter discusses the rules governing stored procedures. For more information about writing specific stored procedures and using reserved words, refer to the Programmer's Reference Manual.