SQL Function
About
A SQL Stored Function is a function that is
- stored in the database.
- accessible by name
A stored function may return:
- a scalar value
- or a result set.
Execution Example
- SQL Query with a scalar function
select upper('lowercase to uppercase')
- Upper function as stored procedure (from this Postgres HowTo) with the JDBC escape syntax
{? = call upper( ? ) }"
- SQL Query with the function setoffunc that returns a result set (from this Postgres HowTo)
SELECT * FROM setoffunc()
Management
Creation
You create a stored function with a SQL DML Request that contains the SQL statements
- CREATE FUNCTION
- or CREATE OR REPLACE FUNCTION
Execution
You execute a SQL stored function by:
- using it in a SQL Query.
- by calling it as SQL stored procedure with an OUT parameter
Database Support
The different way to call and use a function is database dependent.
The below table link to the documentation and to howtos. Tabulify supports by default all database SQL syntax.
| Database | Create Function Documentation | HowTo |
|---|---|---|
| Postgres | sql-createfunction | SETOF function |