Language basics / Types |
Types define a synonym for a base or structured data type.
[PUBLIC|PRIVATE] TYPE type-definition [,...]
where type-definition is:
identifier { { datatype | LIKE [dbname:]tabname.colname } [ ATTRIBUTES( attribute [ = "value" ] [,...] ) ]
User-defined types enforce reusability and simplify programming, by centralizing data structure definitions at a single place.
When defining types with the LIKE clause, the data types are taken from the database schema file at compile time. Make sure that the schema file of the database schema during development corresponds to the database schema of the production database; otherwise the types defined in the compiled version of your modules will not match the table structures of the production database.
Types can be defined with the ATTRIBUTES() clause, to specify meta-data information for the type. This feature is especially used when defining types for XML-based Web Services. For more details about XML attributes, see Attributes to customize XML serialization.