15.10 - Character String Data - Preprocessor2 for Embedded SQL

Teradata Preprocessor2 for Embedded SQL Programmer Guide

prodname
Preprocessor2 for Embedded SQL
vrm_release
15.10
category
Programming Reference
featnum
B035-2446-035K

A character string host variable is defined as an array of characters with a terminating null character ('\0').

The C definition for such a variable is:

char  var1[n];

To define a character string variable, n must be a positive integer, value > 1.

At most, n-1 bytes of data are returned to the host variable.

One position is always reserved for the '\0' terminating null character. Let M be the length of the returned data.

 

Value

TRANSACT Mode

Description

M <= n-1

BTET

COMMIT

2PC

  • M characters are moved to the variable
  • '\0' is placed in the M+1 position of the variable
  • ANSI

    The array is padded with blanks and ‘\0’ is placed in the M+1 position of the variable.

    M > n-1

    any valid choice

  • n-1 characters are moved to the variable
  • position is set to '\0'
  • SQLWARN1 is set to W
  • if the indicator variable is present, it is set to M
  • SQLCODE is set to +902 (ANSI mode only)
  • SQLSTATE is set to ’01004’ (ANSI mode only)
  • This variable has a type of 460 (461 if nullable), with a maximum length of n-1.

    Actual length is determined by the position of the terminating null character ('\0').

    DATE values can be returned to this type of field, providing the format chosen at precompile time fits in n-1 bytes. See “DATE(D|E|I|J|U) -d D|E|I|J|U” on page 71.