Posted on 2012-04-11
In ORacle SQL Developer i see few triggers under the Triggers folder.
The goal of our trigger is to create a a new primary key which is stored in prod_id
create or replace TRIGGER prodschema.prod_ins_id
INSERT ON prodschema.product
FOR EACH ROW WHEN (NEW.prod_id IS NULL)
SELECT seq_prod_id.NEXTVAL -- seq_prod_id is a sequence
, 'PROD_CODE' || seq_prod_id.CURRVAL
what i want to know is we have a insert store procedure which inserts rows into the product table. when this insert procedure is invoked, is the above trigger automatically called ?
I would also like to know what precautions to take when writing and invoking a trigger.