[
https://issues.apache.org/jira/browse/DERBY-4956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dag H. Wanvik updated DERBY-4956:
---------------------------------
Urgency: Normal
Bug behavior facts: [Deviation from standard]
Labels: derby_triage10_8 (was: )
> 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
> Labels: derby_triage10_8
>
> 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.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira