[
https://issues.apache.org/jira/browse/DERBY-4956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13662918#comment-13662918
]
Dag H. Wanvik commented on DERBY-4956:
--------------------------------------
SO which behavior is standard compliant, I wonder?
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira