Transform function requirements
This section lists the transform function requirements.
Table 1 is intended to help you determine what transform functions you need, depending on whether you are binding out to an external routine or a client application.
Characteristic | Passing values from SQL to an external routine | Passing values from an external routine to SQL | Passing values from SQL to a client application | Passing values from a client application to SQL |
---|---|---|---|---|
What is being transformed | Routine parameter | Routine result | Output host variable | Input host variable |
Behavior | Decomposes | Constructs | Encodes | Decodes |
Transform function parameters | Structured type | Row of built-in types | Structured type | One built-in type |
Transform function result | Row of built-in types (probably attributes) | Structured type | One built-in type | Structured type |
Dependent on another transform? | No | No | FROM SQL UDF transform | TO SQL UDF transform |
When is the transform group specified? | At the time the UDF is registered | At the time the UDF is registered | Static: precompile time Dynamic: Special register | Static: precompile time Dynamic: Special register |
Are there data conversion considerations? | No | No | Yes | Yes |
Note: Although not generally the case, client type transforms can
actually be written in SQL if any of the following conditions are
true:
- The structured type contains only one attribute.
- The encoding and decoding of the attributes into a built-in type can be achieved by some combination of SQL operators or functions.