SUMMARY
This technical note describes an issue seen where as database error is received when filtering or drilling on an attribute with time data. This issue is specific to a Teradata warehouse for column data types set to ‘INTEGER 99:99:99’ format.
SYMPTOM
In Strategy Developer or Desktop, users receive the following error message when running a report against a Teradata database:
Error: SQL Generation CompleteQueryEngine encountered error: Execute Query failed..Syntax error, expect something like an 'OR' keyword or ')'
between an integer and "."
STEPS TO REPRODUCE- Using a Teradata warehouse, create a table with a column type of INTEGER FORMAT ’99:99:99’
- In Strategy Developer or Desktop, import this table into a project and create an attribute mapped to this table. The attribute form alias gets created with an INTEGER data type.
- Create a report with this attribute in the filter.
- Execute the report to receive the error.
- View the report SQL, notice the ‘where’ clause displays the data as TIME instead of an integer.
select a11.end_tm end_tm from REVENUE a11 where a11.start_tm in (8:25:00 AM)
CAUSEINTEGER HH:MM:SS data type is handled differently in ODBC and SQL mode. On Strategy Developer/Desktop warehouse catalog, SQL mode is used and the column is fetched as an INTEGER data type. This is the reason why the column alias of this attribute form is of data type INTEGER. However, when retrieving the data for the prompt elements or filter elements, ODBC mode is used and this fetches the data in TIME format. This special behavior of the INTEGER HH:MM:SS format is explained in the Teradata documentation available in the following link:
http://www.info.teradata.com/htmlpubs/DB_TTU_14_10/index.html#page/Connectivity/B035_2498_082K/2498ch03.20.06.html#ww619014Note:The Strategy warehouse catalog can be forced to use ODBC mode and retrieve the column as a TIME data type. However, in that case, the SQL generated as per the TIME data type will result in the error on the Teradata side:
‘[Teradata Database]Invalid operation on an ANSI DateTime or Interval value’
This is again because of the special handling of the INTEGER HH:MM:SS data type on the Teradata side.
ACTIONSet the column type in the Teradata warehouse to INTEGER instead of the special format of ‘INTEGER 99:99:99’. Teradata is deprecating this data type. Refer to the following article for more information:
http://www.info.teradata.com/htmlpubs/DB_TTU_13_10/index.html#page/Connectivity/B035_2509_071A/2509appe.12.1.html