oracle - PL/SQL calling a function inside a trigger -
i trying create function using oracle pl/sql stores current date variable. function called inside trigger. trigger (among other things) insert variable new table has been created. code complies , runs without errors, doesn't work. nothing happens. trigger on delete trigger, when delete 1 row original table, stays. clues missing? thank you.
function:
create or replace function get_date (i_stdid archive_student.stdid%type) return date v_date date; begin select current_date v_date dual; return v_date; end;
function call inside trigger:
create or replace trigger archive_deleted_student after delete on student each row declare v_date archive_student.change_date%type; begin -- other if statements here working v_date := get_date(:old.stdid); insert archive_student (change_date) values (v_date); end;
you doing well, check this sqlfiddle.
only 1 thing - missed stdid
while inserting archive_student
null after insert.
Comments
Post a Comment