db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: VALUES expression, BLOB, and using ij
Date Sun, 27 May 2007 13:04:30 GMT
Alan M. Feldstein wrote:
> Alan M. Feldstein wrote:
>   
>> I should be able to use ij to execute SQL statements
>> interactively ... in order to add a couple of rows to the
>> database.
>>
>> I want to put a couple of rows into the database on a clean machine
>> using a minimalist approach, as proof of concept for the 
>> database specification I'm writing here
>> (http://www.alanfeldstein.com/products/software/fss/download/test_cases_database.html).
>> I'll be just about done writing that Web page once I can explain the
>> requirements for populating the executableFile column. 
>>  
>>     
>
> For a minimalist approach, I tried the following two SQL statements at the
> ij prompt. Both failed.
>   
[ snip - failed statement ]
> ij> INSERT INTO "ADDTestCases" ( "pairID", "expectedSum", "executableFile" )
> VALUES( 1, 0,
> X'7f454c460202010 
>   
[ snip - rest of long line ]
> );
> ERROR 42821: Columns of type 'BLOB' cannot hold values of type 'CHAR () FOR
> BIT DATA'. 
> ij> 
>   
Hello Alan,

I think you have to add "CAST (X'many-hex-values' AS BLOB)" in your 
statement, like this:

ij> create table blobtest (data blob);
0 rows inserted/updated/deleted
ij> insert into blobtest values CAST(X'7f454c4602' AS BLOB);
1 row inserted/updated/deleted
ij> select * from blobtest;
DATA                                                                                     
                                      

--------------------------------------------------------------------------------------------------------------------------------
7f454c4602                                                                               
                                      


1 row selected
ij>


regards,
-- 
Kristian

Mime
View raw message