Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


User-Defined Types and Methods


With user-defined types, it is possible to create new data types that can be used in table definitions and stored procedures. A user-defined type is either structured or distinct. A structured user-defined type has multiple attributes whereas a distinct user-defined type is based on a single data type. The data type used in a user-defined type definition may be a predefined data type or another user-defined type.

It is possible to define methods for a user-defined type. Methods are very similar to functions, they have only in parameters and returns a single value. There are three different types of methods, constructor, instance and static methods.

Constructor methods are used to create new instances of a user-defined type, i.e. assigning values to attributes. An instance method can only be used with an instance of a user-defined type. A static method is similar to a function, the only difference is how they are invoked. Both instance and constructor methods have an implicit parameter named SELF which represents an instance of a user-defined type. When a structured user-defined type is created, instance methods for accessing and modifying attributes are created implicitly.

It is possible to alter a user-defined type by adding or dropping attributes and adding or dropping methods.

An ident can use a user-defined type created by another ident, if the user has been granted usage privilege on the user-defined type. Likewise, in order to be able to use a method the user must have been granted execute privilege on the method.


Mimer
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
info@mimer.se
Mimer SQL Documentation TOC PREV NEXT INDEX