Cast from character types to int is different for literals and non-literals
---------------------------------------------------------------------------
Key: DERBY-4956
URL: https://issues.apache.org/jira/browse/DERBY-4956
Project: Derby
Issue Type: Bug
Components: SQL
Affects Versions: 10.7.1.1
Reporter: Knut Anders Hatlen
Priority: Minor
A string representing a floating point number can be cast to int if the string
is a literal, but not otherwise. Casting of literals and non-literals to int
should behave the same way.
Examples:
ij> values cast('1.1' as integer);
1
-----------
1
1 row selected
ij> values cast(cast('1.1' as char(3)) as integer);
1
-----------
ERROR 22018: Invalid character string format for type INTEGER.
ij> values cast(cast('1.1' as varchar(3)) as integer);
1
-----------
ERROR 22018: Invalid character string format for type INTEGER.
ij> values cast('1e3' as int);
1
-----------
1000
1 row selected
ij> values cast(cast('1e3' as char(3)) as int);
1
-----------
ERROR 22018: Invalid character string format for type INTEGER.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.