FALCONSEYE
Programmer
I am working on an update/delete trigger on tblProjects. The idea is to keep track of the project's version by keeping a history in tblProjectHistory.
I am not quite sure how to do this but this is what I have so far:
Every insert into history table will have previous version + 1. The above code throws an error. It doesn't like
I found some info where they were calling functions. Should I write a function or is there a better way of doing this? Thanks in advance.
I am not quite sure how to do this but this is what I have so far:
Code:
CREATE OR REPLACE TRIGGER trg_ProjectHistory
BEFORE UPDATE OR DELETE
ON tblPROJECTS
REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
declare tmpVersion number;
BEGIN
select version+1 into tmpVersion from tblPROJECTS
where project_id = :old.project_id);
...
Every insert into history table will have previous version + 1. The above code throws an error. It doesn't like
Code:
select version+1 into tmpVersion from tblPROJECTS
where project_id = :old.project_id);
I found some info where they were calling functions. Should I write a function or is there a better way of doing this? Thanks in advance.