Result Type and Attributes - Advanced SQL Engine - Teradata Database

SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/djk1612415574830.ditamap
dita:ditavalPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/wrg1590696035526.ditaval
dita:id
B035-1145
lifecycle
previous
Product Category
Teradata Vantage™

The following table lists the data type for the result of REGR_COUNT(y,x).

Mode Data Type
ANSI If MaxDecimal in DBSControl is…
  • 0 or 15, then the result type is DECIMAL(15,0).
  • 18, then the result type is DECIMAL(18,0).
  • 38, then the result type is DECIMAL(38,0).
Teradata INTEGER

The result type of REGR_COUNT is consistent with the result type of COUNT for ANSI transaction mode and Teradata transaction mode.

When in Teradata mode, if the result of REGR_COUNT overflows and reports an error, you can cast the result to another data type, as illustrated by the following example.

   SELECT CAST(REGR_COUNT(weight,height) AS BIGINT)
   FROM regrtbl;
Here are default formats and titles for the result of REGR_COUNT.
  • If operand y is numeric or character, the format is:
    • For ANSI mode, if MaxDecimal in DBSControl is:

      0 or 15, the format is -(15)9

      18, the format is -(18)9

      38, the format is -(38)9

    • For Teradata mode, the format is the default format for INTEGER
  • If operand y is UDT, the format is the format for the data type to which the UDT is implicitly cast.