16.20 - Example Using FNC_GetQueryBandU - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

SQL Definition

REPLACE FUNCTION GetQueryBandExample()
    RETURNS VARCHAR(6159) CHARACTER SET UNICODE
    LANGUAGE C
    NO SQL
    PARAMETER STYLE TD_GENERAL
    EXTERNAL NAME 'CS!GetQBExample!GetQBExample.c';

C Function Definition

#define SQL_TEXT Latin_Text

#include<string.h>
#include<sqltypes_td.h>          

extern void
FNC_GetQueryBandU(void      *QBandBuf,
                  int        BufSize,
                  int       *QBandLen);  


/****************************************************/

void GetQueryBandExample (
        VARCHAR_UNICODE *QBandBuf,         
        char sqlstate[6])
{
    int QBandLen;
    int MaxQBLen;
              
    MaxQBLen = FNC_MAXQUERYBANDSIZE_U;
    
    FNC_GetQueryBandU(QBandBuf, MaxQBLen, &QBandLen); 

    return;
}