17.00 - 17.05 - PERIOD型の値の設定例 - 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
日本語 (日本)
void set_duration( DATE       *date1,
                   DATE       *date2,
                   PDT_HANDLE *result,
                   int        *date1IsNull,
                   int        *date2IsNull,
                   int        *resultIsNull,
                   char        sqlstate[6])
                   SQL_TEXT    extname[129],
                   SQL_TEXT    specific_name[129],
                   SQL_TEXT    error_message[257] )
{
    DATE new_duration[2];

    /* Set the value of the PERIOD(DATE) result. */
    if (*date2 > *date1)
    {
       new_duration[0] = *date1;
       new_duration[1] = *date2;
    }
    else if (*date1 > *date2)
    {
       new_duration[0] = *date2;
       new_duration[1] = *date1;
    }
    else
    {
       strcpy(sqlstate, "22023");
       strcpy((char *) error_message,
          "PERIOD element values cannot be equal.") ;
       *resultIsNull = -1;
       return;
    }
    FNC_SetInternalValue(*result, &new_duration[0], SIZEOF_DATE*2); 

    ...

}