17.00 - 17.05 - C関数定義 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL外部ルーチン プログラミング

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
17.05
Published
2020年6月
Content Type
プログラミング リファレンス
Publication ID
B035-1147-170K-JPN
Language
日本語 (日本)
#define SQL_TEXT Latin_Text
#include <sqltypes_td.h>
#include <string.h>
/* return a pointer to the SQLSTATE string */
void *Find_Text(VARCHAR_LATIN *searched_string,
                VARCHAR_LATIN *pattern,
                CHARACTER_LATIN  *result,
                char  sqlstate[6])
{
  int pattern_found = 0;
  if (strlen((char *)pattern) == 0)
  {
      /* send a warning because probably a mistake */
      *result = 'T';
      strcpy(sqlstate, "01H01"); /* see SQLSTATE table */
      return;
  }
  /* do the pattern match -- code not shown */
  ...
  if (pattern_found)
      *result = 'T';
  else
      *result = 'F';
  /* SQLSTATE is initialized to zero so normal return does */
  /* not need to set it */
  return;
}