Typedefs

Declares new names for existing datatypes.

Syntax

typedef existingdatatypeName newdatatypeName;

Components

existingdatatypeName The original datatype.
newdatatypeName The new name for the datatype.

Usage

Typedefs allow giving new names for existing datatypes, which can be used to define new variables and parameters, and specify the return type of functions. Typedefs can be declare in declare blocks, UDFs and inside FLEX procedures. The types declared in typedefs must resolve to simple types.

Note: For unsupported datatypes, use a typedef in a declare block to create an alias for a supported datatype.

Example

This example declares euros to be another name for the money(2) datatype:
typedef money(2) euros;
Once you have defined the euro typedef, you can use:
euros price := 10.80d2;
which is the same as:
money(2) price := 10.80d2;