FNC_GetStructuredResultLobAttribute Function | C Library Functions | Vantage - FNC_GetStructuredResultLobAttribute - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

Returns the locator of a LOB attribute of a structured type that is defined to be the return value of a UDF or UDM, or an INOUT or OUT parameter to an external stored procedure.

For best performance, use FNC_GetStructuredResultLobAttributeByNdx instead of this routine. This routine is supported for ease of use.

Syntax

void
FNC_GetStructuredResultLobAttribute ( UDT_HANDLE          udtHandle,
                                      char               *attributePath,
                                      LOB_RESULT_LOCATOR *object )

Syntax Elements

udtHandle
the handle to a structured UDT that is defined to be the return value of a UDF or UDM or an INOUT or OUT parameter to an external stored procedure.
attributePath
the dot delimited full path to the LOB attribute.

For example, consider a structured UDT called PersonUDT that has an attribute called passport that is a PassportUDT type, which in turn has a LOB attribute called photo. To get the locator of the photo attribute, the full path is "passport.photo".

object
a pointer to the LOB locator for the LOB attribute.

Usage Notes

You can use FNC_GetStructuredResultLobAttribute to obtain the LOB locator for a distinct type attribute that represents a LOB type.

After you obtain the LOB locator for the attribute of the structured type, use the LOB access functions, such as FNC_LobOpen, to append data.

You can use FNC_GetStructuredResultLobAttribute to write data to a JSON attribute. This function returns a LOB_RESULT_LOCATOR which represents a LOB where the data of a JSON attribute may be stored. You can use this LOB_RESULT_LOCATOR with LOB FNC routines to write the data to the JSON attribute. You must use FNC_GetStructuredResultLobAttribute if the JSON data to be written is larger than 64000 bytes. If the JSON data is equal to or less than 64000 bytes, you can still use FNC_GetStructuredResultLobAttribute to write the data; however, you may get better performance if you use FNC_SetStructuredAttribute instead.

By default, a structured UDT that an external routine returns has all of its attributes (except attributes that are themselves structured UDTs) set to null. If an external routine does not append any data to a LOB attribute of a structured type, that attribute remains null.

Setting the result indicator argument to -1 for an external routine that uses parameter style SQL discards any data that was appended to a LOB attribute. An external routine that appends data to a LOB attribute cannot reset the LOB attribute back to null if the result indicator argument is not set to -1.

A LOB attribute of a structured type that is defined to be an INOUT parameter to an external stored procedure retains the input version if no data is appended to the LOB attribute.

An external stored procedure that uses CLIv2 to execute SQL must wait for any outstanding CLIv2 requests to complete before calling this function.

Example Using FNC_GetStructuredResultLobAttribute

void document_t_lowerCase( UDT_HANDLE *documentUdt,
                           UDT_HANDLE *resultDocumentUdt,
                           char        sqlstate[6])
{
    LOB_RESULT_LOCATOR resultDocLoc;

    /* Get a LOB_RESULT_LOCATOR for the result doc attribute. */
    FNC_GetStructuredResultLobAttribute(*resultDocumentUdt, "doc", 
                                        &resultDocLoc);