Add a parameter list
When you create an SPL routine, you can define a parameter list so that the routine accepts one or more arguments when it is invoked. The parameter list is optional.
- Built-in data types
- Opaque data types
- Distinct data types
- Row types
- Collection types
- Smart large objects (CLOB and BLOB)
- SERIAL
- SERIAL8
- BIGSERIAL
- TEXT
- BYTE
For the serial data types, however, a routine can return numerically equivalent values that are cast to a corresponding integer type (INT, INT8, or BIGINT). Similarly, for a routine to support the simple large object data types, the parameter list can include the REFERENCES keyword to return a descriptor that points to the storage location of the TEXT or BYTE object.
- You request that the user supply a value when the routine is executed.
- You implicitly define a variable (with the same name as the parameter name) that you can use as a local variable in the body of the routine.
If you define a parameter with a default value, the user can execute the SPL routine with or without the corresponding argument. If the user executes the SPL routine without the argument, the database server assigns the parameter the default value as an argument.
When you invoke an SPL routine, you can give an argument a NULL value. SPL routines handle NULL values by default. However, you cannot give an argument a NULL value if the argument is a collection element.