db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Van Vlierberghe, Steven" <steven.van.vlierber...@esko.com>
Subject Insert into Table (identity,CLOB) impossible ?? how to ?
Date Fri, 10 Aug 2007 09:26:51 GMT
Use case:
  MyTable (id identity, data CLOB)
  insert some bytes into the table and return the id of the record

1. I need the generated key (identity), so I cannot use a
beause with Derby, one can only get the generated key via
Statement.execute (sql, RETURN_GENERATED_KEYS);

2. Hence, as a PreparedStatement cannot be used, a Statement must be
Now, of course, I do not want (or even can) to form a String for an SQL
insert statement in which the CLOB is included .

3. Euh, that brings me , in order to insert an CLOB, to create a record
first, get the generated key and then update that record with the clob
So, in 2 phases
  first:  id = DoInsert ();
  second:  DoUpdate (id,data);
Tried this as well,
if one does:      stm.execute ("insert into MyTable")
or stm.execute ("insert into MyTable () values ()")
dont' go  :   syntax errors

So, how to insert some bytes into a table with an identity column and
have the identity value as return value ??

Any solution welcome


View raw message