db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Kellerer <spam_ea...@gmx.net>
Subject Re: Problem with cast
Date Tue, 04 Mar 2008 22:01:02 GMT
Kathey Marsden wrote on 04.03.2008 22:57:
> Thomas Kellerer wrote:
>> When I run the following statement:
>>
>> SELECT cast(id AS VARCHAR) FROM mytable;
>>
>> I get an error:
>>
>> ERROR 42X01: Syntax error: Encountered ")" at line 1, column 26.
>>
> If you specified the length of the varchar, you would get a clearer 
> message.
> ij> select cast(id as VARCHAR(30)) from mytable;
> ERROR 42846: Cannot convert types 'INTEGER' to 'VARCHAR'.
> 
> 
> Perhaps doing
> select id from mytable;
> 
> and then using ResultSet.getString() to do the string conversion would 
> work for you.
> 
> Kathey
> 
> 
So I cannot cast an integer to a varchar.

I thought I'd seen a 'Y' in the relevant cell of the matrix describing the 
allowed conversions in the manual. But a second look clearly shows a -

Thanks for the quick answer.

Thomas


Mime
View raw message