Database Functions

Database Functions are a feature that some DBMS products implement to provide users with a mechanism to extend the functionality of the database server.  A Database Function is a routine that accepts parameters, performs an action (such as a complex calculation) and returns the result of that action as a value. Depending on the Function, the return value can be either a single value or a result set.

Once created, a Database Function can be used as an expression in an SQL statement.

In Enterprise Architect, Database Functions can be modeled in one of two ways:

·As individual objects (the default method) or
·As Operations in a container


Functionally the two methods result in the same DDL being produced. The main difference is visual - by having several Operations in one container, you have fewer elements and less clutter on the diagram.

Individual objects

Database Functions modeled as individual objects are UML Classes with the stereotype «function»; you create these by dragging the Function icon onto a diagram  from the Data Modeling Toolbox.



Toolbox Icon


Operations in a Container

Database Functions modeled as operations have a container object, this being a UML Class with the stereotype «functions» (with an s on the end).  Each Function is an operation with the stereotype «func». The system provides a dedicated maintenance window through which the modeler can easily manage the Functions stored as operations.



Learn more