Skip to content

Instantly share code, notes, and snippets.

@bendem
Created December 19, 2013 19:48
Show Gist options
  • Save bendem/8045081 to your computer and use it in GitHub Desktop.
Save bendem/8045081 to your computer and use it in GitHub Desktop.
-- ----------------------------------------------
-- @Author: bendem
-- @Date: 2013-12-17 12:10:38
-- @Last Modified by: bendem
-- @Last Modified time: 2013-12-19 12:07:26
-- ----------------------------------------------
CREATE OR REPLACE TRIGGER BeforeRow
BEFORE UPDATE ON TestProc
FOR EACH ROW
DECLARE
BeginByO EXCEPTION;
roted TestProc.b%type;
BEGIN
IF INSTR(LOWER(:new.b), 'o') != 0 THEN
raise BeginByO;
END IF;
IF INSTR(LOWER(:old.b), 'fix') != 0 THEN
rot(:old.b, roted, 3);
:new.b := REPLACE(:new.b, :old.b, roted);
dbms_output.put_line('Mon tuple initial est ' || :old.b);
dbms_output.put_line('Mon tuple modifie est ' || :new.b);
END IF;
EXCEPTION
WHEN BeginByO THEN
raise_application_error(-20001, 'Erreur');
WHEN OTHERS THEN
dbms_output.put_line('Hey!');
END;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment