drop Table Truffle;
drop Sequence TSeq;

Create sequence TSeq
Increment by 1
Start with 1
Nocycle;

create table Truffle (
TruffleID number,
CoatingFlavor char(10) NOT NULL,
FillingFlavor char(10) NULL,
CONSTRAINT Truffle_PK PRIMARY KEY(TruffleID));

CREATE or REPLACE TRIGGER autonumber
BEFORE INSERT ON Truffle
FOR EACH ROW
BEGIN
SELECT TSeq.nextval INTO :new.TruffleID FROM DUAL;
END;
/

Insert into Truffle (CoatingFlavor, FillingFlavor) values (
'choc', 'choc');

Insert into Truffle values (
TSeq.nextVal, 'choc', 'mint');

Insert into Truffle (TruffleID, CoatingFlavor) values (
TSeq.nextVal, 'choc');
