Special conversion cases

Conversion of string literals

Teiid automatically converts string literals within a SQL statement to their implied types. This typically occurs in a criteria comparison where an expression with a different datatype is compared to a literal string. For example:

SELECT * FROM my.table WHERE created_by = '2016-01-02'

In the preceding example, if the created_by column has the data type of date, Teiid automatically converts the data type of the string literal to a date.

Converting to Boolean

Teiid can automatically convert literal strings and numeric type values to Boolean values as shwon in the following table:

Table 1. Boolean conversions
Type Literal value Boolean value

String

'false'

false

'unknown'

null

other

true

Numeric

0

false

other

true

Date and time conversions

Teiid can implicitly convert properly formatted literal strings to their associated date-related data types as shown in the following table:

Table 2. Date and time conversions
String literal format Possible implicit conversion type

yyyy-mm-dd

DATE

hh:mm:ss

TIME

yyyy-mm-dd[ hh:mm:ss.[fff…]]

TIMESTAMP

The preceding formats are those expected by the JDBC date types. For information about using other formats, see the functions PARSEDATE, PARSETIME, and PARSETIMESTAMP in Date and time functions.

results matching ""

    No results matching ""