db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kathey Marsden <kmarsdende...@sbcglobal.net>
Subject Re: Problem with cast
Date Tue, 04 Mar 2008 21:57:31 GMT
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.


View raw message