Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How can I ceate a table primary key that auto increase by itself like access table id key ?
Add a sequence, then create trigger to update the key.
Just like:
CREATE SEQUENCE CHR_MAS_SEQ START WITH 1 NOCACHE;
CREATE OR REPLACE TRIGGER CHR_MAS_INS_TRIG
BEFORE INSERT ON CHR_MAS
FOR EACH ROW
DECLARE
SEQ_VAL NUMBER;
BEGIN
SELECT CHR_MAS_SEQ.NEXTVAL
INTO SEQ_VAL FROM DUAL;
:NEW.ID := SEQ_VAL;
END;
/
"Britney Spears" <deboer76_at_163.com> wrote in message
news:b3uqim$1hck$1_at_mail.cn99.com...
> How can I ceate a table primary key that auto increase by itself like
access
> table id key ?
> Is there any nature support on Oracle ?
>
>
Received on Mon Mar 03 2003 - 02:04:06 CST