standard way is to create a sequence and then use a trigger when inserting 
a row into the table, rather than explain any further, here's some code...

/* dummy table */
CREATE TABLE test (
         ID integer NOT NULL ,
         sometext varchar2(50) NOT NULL ,
         PRIMARY KEY (ID)
         );

/* Sequence and trigger to reproduce SQL server autoincrement feature */
CREATE SEQUENCE testID NOCACHE;
CREATE OR REPLACE TRIGGER test_AutoID
BEFORE INSERT ON test
FOR EACH ROW
BEGIN
         SELECT testID.NextVal
         INTO :new.ID
         FROM dual;
END test_AutoID;



Mark




At 05:34 PM 4/24/2001, you wrote:
>I tried to use the download custom CF_max_id to do the autonumbering
>for inserting a new row into a oracle database table but the custom
>tag failed.  I am wondering if anyone knows oracle have idea how to
>do it.  I have the first column in the table named "ContentId"
>defined with datatype "number".  I would like to have the contentid
>incremented by 1 for each now row inserted.  Someone works with
>oracle please let me know how to do this.
>
>thanks
>
>
>
>
>
>--------------------------------------------------------------------------
>Global Internet phone calls, voicemail, fax, e-mail and instant messaging.
>Sign-up today at http://www.hotvoice.com
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to