db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernt Marius Johnsen <bernt.john...@oracle.com>
Subject Re: Inserting control characters in SQL
Date Mon, 14 Mar 2011 09:19:48 GMT
Bruce Wen wrote:
>   If indeed necessary to insert one control character, you need insert 
> the int value (ASCII code) of the control character, I think. Of course, 
> the column's data type should be int or tinyint.

Note that Derby strings are UNICODE, not ASCII. The solution is 
dependent on what you actually want to do. If you want to store ASCII 
control characters, I would recommend to use an integer column. If you 
want to store Unicode control characters in CHAR or VARCHAR columns, you 
can't do that from SQL since Derby does not support feature "F393 
Unicode escapes in literals" (See 
http://wiki.apache.org/db-derby/SQLvsDerbyFeatures).

You can insert Unicode control characters from Java through JDBC, though.

> 
> -----Original Message-----
> From: John English <john.foreign@gmail.com>
> To: derby-user@db.apache.org
> Sent: Sat, Mar 12, 2011 12:13 am
> Subject: Re: Inserting control characters in SQL
> 
> On 11/03/2011 17:46, John English wrote: 
>  > On 11/03/2011 17:42, Peter Ondruška wrote: 
>  >> Have you tried \b ? 
>  > 
>  > Hmm, silly me. I tried RTFMing -- stupid thing to do! 
>  
> OK, now I've tried it. It doesn't work. LENGTH('\b') == 2, not 1. 
>  
> Any other suggestions? 
>  
> ------------------------------------------------------------------------ 
>  John English | My old University of Brighton home page is still here: 
>   | http://www.it.brighton.ac.uk/staff/je 
> ------------------------------------------------------------------------ 


Mime
View raw message