ROUTINE_TYPE global variable
This built-in global variable contains the type of the currently executing routine.
This global variable has the following characteristics:
- It is read-only, with values maintained by system.
- The type is CHAR(1).
- The schema is SYSIBM.
- The scope of this global variable is session.
If the ROUTINE_TYPE global variable is referenced outside a routine execution context, the value of the variable is NULL.
The value of the ROUTINE_TYPE global variable is P for a stored procedure and F for a function.
The value of the ROUTINE_TYPE global variable is set only for procedures and compiled functions: the value always reflects the type of the currently executing routine.
The value does not change for inline functions or methods: the value remains the same as it was when the inline function or method was invoked.