Top
Symfoware Server V12.1.0 Application Development Guide
FUJITSU Software

1.5.3 Using Functions

The default functions provided with Symfoware Server enable a variety of operations and manipulations to be performed, and information to be obtained, using SQL statements.

However, it is possible that internal Symfoware Server functions, such as those relating to statistical information or for obtaining system-related information, may change as Symfoware Server versions are upgraded.

Accordingly, when using these functions, define them as new functions and then use the newly-defined functions in the applications.

An example of defining and using a function is shown below.

Example

CREATE FUNCTION my_func(relid regclass) RETURNS bigint LANGUAGE SQL AS 'SELECT pg_relation_size(relid)';
SELECT my_func(2619);

If changes are made to a function, the user will be able to take action by simply redefining the function, without the need to make changes to the application.

The following shows an example of taking action by redefining a function as if no changes were made.

The pg_relation_size function is redefined after arguments are added.

Example

DROP FUNCTION my_func(regclass);
CREATE FUNCTION my_func(relid regclass) RETURNS bigint LANGUAGE SQL AS 'SELECT pg_relation_size(relid,$$main$$)';