Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: oracle listener ("auto increment value" for PK)
Hi Markus!
Here's a recipe that might help you (assuming your table is called "MYTABLE":
CREATE SEQUENCE MYTABLE_Sequence start with 1 increment by 1 nocycle nocache;
2. create an insert trigger
CREATE OR REPLACE
TRIGGER MYTABLE_Insert_Trigger
BEFORE INSERT ON MYTABLE
FOR EACH ROW
DECLARE
n PLS_INTEGER;
BEGIN
HTH & Servus!
Andreas
-----Original Message-----
From: pfeffer [mailto:m.pfeffer_at_inode.at]
Sent: Monday, July 14, 2003 10:39 PM
To: Multiple recipients of list ORACLE-L
Subject: oracle listener
hi
i run oracle8 on w2000 advanced server.
my question is how to create a auto increment primary key for this table:
id number(5)
name varchar(12)
id should auto increment after inserting a new datarow must i create a trigger ?
excuse my bad english
thx
martin
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: pfeffer
INET: m.pfeffer_at_inode.at
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Jul 15 2003 - 12:59:39 CDT