Oracle Trigger Replace

457 views Asked by At

We have cloned a schema "old_schema_name" to a new schema with name "new_schema_name". But due to triggers (and procedures) referencing old schema name we had to drop triggers to not have the old schema effected. For example: we have following trigger (which is dropped) on Schema "New_schema_name" , we want to update this trigger so that it does not reference "old_schema_name".

Is just adding Trigger (via Create or replace trigger) enough for this trigger to be activated ?

DROP TRIGGER NEW_SCHEMA_NAME.TRG_UPDATE_SOMETHING;

CREATE OR REPLACE TRIGGER NEW_SCHEMA_NAME.TRG_UPDATE_SOMETHING
BEFORE DELETE OR INSERT OR UPDATE
ON OLD_SCHEMA_NAME.SOME_CONFIG REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
DISABLE
DECLARE
tmpVar NUMBER;

BEGIN
tmpVar := 0;
SELECT someseq.nextval INTO tmpVar FROM dual;
UPDATE UPDATE_VERSION SET counter = tmpVar, upd_time= sysdate WHERE id =      'SomeID';   
EXCEPTION
WHEN OTHERS THEN
    RAISE;
END TRG_UPDATE_SOMETHING;
0

There are 0 answers