これを試してください:
CREATE OR REPLACE TRIGGER TRIGGER1
BEFORE INSERT ON ACCOUNTS
FOR EACH ROW
WHEN (new.ID IS NULL)
BEGIN
:new.ID := ACCOUNTS_SEQ.NEXTVAL;
END;
/
シーケンスは次のようになります:
CREATE SEQUENCE ACCOUNTS_SEQ
START WITH 1
INCREMENT BY 1;
これを試してください:
CREATE OR REPLACE TRIGGER TRIGGER1
BEFORE INSERT ON ACCOUNTS
FOR EACH ROW
WHEN (new.ID IS NULL)
BEGIN
:new.ID := ACCOUNTS_SEQ.NEXTVAL;
END;
/
シーケンスは次のようになります:
CREATE SEQUENCE ACCOUNTS_SEQ
START WITH 1
INCREMENT BY 1;