A locator is valid only while running the UDF to which the locator is passed as an argument. Because of this limitation, a locator cannot be passed in the intermediate aggregate storage area that aggregate functions use to accumulate summary information.
Instead, an aggregate function must convert a locator to a persistent object reference, a reference that is valid while running the SQL request.
The sqltypes_td.h header file defines a persistent object reference as a LOB_REF type:
typedef struct LOB_REF{
unsigned char data[50];
} LOB_REF;
A LOB_REF is invalid outside the request in which it is created. If you try to pass a LOB_REF out of the request (by storing it in a table, for example) and later attempt to convert it back to a locator, the function fails.
To convert a locator to or from a persistent object reference that can be passed in the intermediate aggregate storage area, Teradata provides the following library functions:
- FNC_LobLoc2Ref
- FNC_LobRef2Loc
| Topic | Reference |
|---|---|
| Detailed information on FNC_LobLoc2Ref and FNC_LobRef2Loc, including examples of how to use the functions | C Library Functions |
| A complete example of an aggregate function using LOBs | C Aggregate Function Using LOBs |