I'm experimenting with sequences and triggers. I've created a sequence called AUTONUM, a table named EMP (columns EMP_ID, EMP_NAME, EMP_DEPT) and the following trigger.
My impression would be that this would mean that I could use an insert like:
But it is looking for the EMP_ID field to be filed. Isn't that what the trigger does?
Code:
CREATE OR REPLACE TRIGGER "BI_EMP"
before insert on "EMP"
for each row
begin
select "AUTONUM".nextval into :NEW.EMP_ID from dual;
end;
My impression would be that this would mean that I could use an insert like:
Code:
INSERT INTO EMP VALUES ('John', 'Sales');
But it is looking for the EMP_ID field to be filed. Isn't that what the trigger does?