Conversion of String Literals

CData Virtuality Server は、SQL 文内の文字列リテラルを自動的に暗黙の型に変換します。これは通常、異なるデータ型を持つ式がリテラル文字列と比較される基準比較で発生します:

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

created_byカラムのデータ型がdateの場合、CData Virtuality Server は自動的に文字列リテラルをdateデータ型に変換します。

If your string literal does not match the default pattern for date (or time or timestamp) datatype, the CData Virtuality Server will implicitly convert the column to a string. Instead of a date/date (time/time, ...) comparison, you will have a string/string comparison executed. This can lead to incorrectly looking result sets. For example, ...WHERE created_by = ‘20030102’ will be executed as ...WHERE cast(created_by as string) = ‘20030102’.

 Converting to Boolean

CData Virtuality Server は、リテラル文字列と数値型の値を次のように自動的にブーリアン値に変換できます:

Type

Literal value

Boolean value

String

'false'

FALSE


'unknown'

NULL


other

TRUE

Numeric

0

FALSE


other

TRUE

Date/Time/Timestamp/Datetimeoffset Type Conversions

CData Virtuality Server は、以下のように、適切にフォーマットされたリテラル文字列を、関連する日付関連データ型に暗黙的に変換することができます:

String literal format

Possible implicit conversion type

yyyy-MM-dd

DATE

hh:mm:ss

TIME

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

TIMESTAMP

yy-MM-dd hh:mm:ss ZZZZ

TIMESTAMP

上記の書式は、JDBCの日付型が期待する書式です。他のフォーマットを使用するには、PARSEDATEPARSETIME, PARSETIMESTAMP functionsをご利用ください。