long time user, first time "asker".
i attempt construct oracle procedure and/or trigger compare 2 tables minus operation , insert resulting rows table. understand how query in standard sql, having trouble coming efficient way using pl/sql.
admittedly, new oracle , pretty green sql in general. may silly way go accomplishing goal, allow me explain attempting do.
i need create sort of alert triggered when v_$parameter view changed. apparently triggers can not respond changes view but, instead, can replace actions on views...which not wish do. so, did create table mirror view save "snapshot".
create table mirror_v_$parameter select * v_$parameter;
then, attempted make procedure minus these 2 that, whenever change made v_$parameter, return difference between snapshot, mirror_v_$parameter. trying create cursor command:
select * v_$parameter minus select * mirror_v_$parameter;
to used inside procedure, used fetch returned rows , insert them table called alerts_v_$parameter. intent being that, when added "alert" table, trigger can used somehow (haven't gotten far yet) notify team there has been change v_$parameter table, , can refer alerts_v_$parameter see has been change. use kind of script run procedure @ regular interval. , maybe, day down line when understand better, manipulate goes alerts_v_$parameter table provides better information such column changed, previous value, etc.
any advice or pointers?
thank taking time read this. thoughts appreciated.
i create table based on exact structure of v_$parameter additional timestamp column "last_update", , periodically (via dbms_scheduler) merge changes real v_$parameter table , capture timestamp of detected change.
you might populate history table @ same time, either using triggers on update of table or sql.
pl/sql unlikely required, except procedural wrapper sql code.
examples of merge in documentation here: http://docs.oracle.com/cd/e11882_01/server.112/e26088/statements_9016.htm#sqlrf01606
Comments
Post a Comment