
November 20th, 2003, 12:45 PM
|
|
Junior Member
|
|
Join Date: Nov 2003
Location: newcastle
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
auto id with trigger
Hi i dont know why this trigger wont work all i want it to do is count how many entries are in the table then add one to create the primary key every time the table is updated
____________________________________________________CODE
____________________________________________________
CREATE OR REPLACE TRIGGER auto_id
BEFORE INSERT ON student
FOR EACH ROW
BEGIN
select count(ID) + 1 into :new.ID from dual;
END;
/
____________________________________________________
any ideas thanxs
|