First, create the sequence that you want to use.

create sequence MySequenceName start with 100 increment by 1

Next, use the sequence

insert into table
(table_pkey, ....)
values
(MySequenceName.nextval, ...)

95% of the time it works to use it in the insert statement.  If you need the
number after the insert, you'll have to select it out before hand - 

select MySequenceName.nextval "PKEY" from dual

<CFLOOP query=...>
  <CFSET pkey=PKEY>
</CFLOOP>

then,

insert into table
(table_pkey, ....)
values
(#pkey#, ...)


Brian

-----Original Message-----
From: Jamie Symonds [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 02, 2001 9:37 AM
To: CF-Talk
Subject: Oracle Auto-Increment


Hi - I am inserting results of a form into an Oracle 8
database - in the past, while using Access, I would set the
first field of the table ("id") to "auto-number" for my
primary key.  Oracle does not have an auto-increment feature
- how do I go about this?  Thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to