Thanks for the reply, Rick.  I was using identify columns, but then found that Oracle does not support identity columns, only sequences.  Since I'm looking for cross-database portability, I'm sticking with sequences - I'm using Hibernate, and it will automatically choose between a sequence and using a table to simulate a sequence based on capabilities of the DB. 

Ryan

> From: Rick Hillegas <rick.hillegas@oracle.com>
Subject: Re: Sequences as default values for a column
Hi Ryan,

I don't know whether you have considered identity columns. Identity columns may give you what you need. See the Derby Reference Guide topics " CREATE TABLE statement" -> "column-definition" -> "generated-column-spec". Right now, identity columns provide less concurrency than sequences do. However, identity columns should catch up to sequences in 10.8.2 due to the work on https://issues.apache.org/jira/browse/DERBY-4437

Hope this helps,
-Rick

On 7/8/11 12:59 PM, Ryan McFall wrote:
>From what I can see in the Derby documentation, it's not possible to specify the value of a sequence as the default value for a column.  Is my reading of this correct?

I've seen solutions online for Oracle, which also supports sequences, that suggest using a before insert trigger to modify the value of a column with a sequence value if the value is not specified.  This seems like it's more work than it should be; specifying it as a default in the table definition makes much more sense to me.

Thanks for any insights you have,
Ryan

--
Ryan McFall
Associate Professor of Computer Science
Hope College
Holland, MI  49423
Email: mcfall@hope.edu
Phone: 616-395-7952
Fax: 616-395-7123
http://www.hope.edu/cs/mcfall/