Executing routines

You can execute an SPL routine or external routine in any of these ways:
  • Using a stand-alone EXECUTE PROCEDURE or EXECUTE FUNCTION statement that you execute from DB-Access
  • Calling the routine explicitly from another SPL routine or an external routine
  • Using the routine name with an expression in an SQL statement

An additional mechanism for executing routines supports only the sysdbopen and sysdbclose procedures, which the DBA can define. If a sysdbopen procedure whose owner matches the login identifier of a user exists in the database when the user connects to the database by the CONNECT or DATABASE statement, that routine is executed automatically. If no sysdbopen routine has an owner that matches the login identifier of the user, but a PUBLIC.sysdbopen routine exists, that routine is executed. This automatic invocation enables the DBA to customize the session environment for users at connection time. The sysdbclose routine is similarly invoked when the user disconnects from the database. (For more information about these session configuration routines, see the HCL OneDB™ Guide to SQL: Syntax and the HCL OneDB Administrator's Guide.)

An external routine is a routine written in C or some other external language.