Tuesday, October 04, 2005

Oracle Tip: How to use default values with database columns

"One very common problem is to emulate the Autonumber functionality of other database vendors where a column is automatically populated with some kind of sequence number. In Oracle databases, you cannot specify a sequence number as a DEFAULT value for a column; however, you can emulate this functionality using a trigger. Even if a column is declared NOT NULL, you can still omit the column from INSERT statements to be populated in the trigger."