表名 FAULT_HIS
因为其他程序插入字段FAULT_PART 字段的中文时有乱码。所以通过另一个字段 FAULT_PART_ENG字段来判断中文内容是什么,并在插入前触发修改。
TRIGGER TR_FAULT_HIS
BEFORE INSERT ON FAULT_HIS
FOR EACH ROW
BEGIN
IF(
:NEW.FAULT_PART_ENG = ‘YDWGR’
)
THEN :NEW.FAULT_PART := ‘油低温过热’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YZWGR’
)
THEN :NEW.FAULT_PART := ‘油中温过热’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YGWGR’
)
THEN :NEW.FAULT_PART := ‘油高温过热’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YGWGR’
)
THEN :NEW.FAULT_PART := ‘油高温过热’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YHJYZDWGR’
)
THEN :NEW.FAULT_PART := ‘油和绝缘纸低温过热’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YHJYZZWGR’
)
THEN :NEW.FAULT_PART := ‘油和绝缘纸中温过热’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YHJYZGWGR’
)
THEN :NEW.FAULT_PART := ‘油和绝缘纸高温过热’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YZYDH’
)
THEN :NEW.FAULT_PART := ‘油中有电弧’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YHJYZZYDH’
)
THEN :NEW.FAULT_PART := ‘油和绝缘纸中有电弧’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YZJBFD’
)
THEN :NEW.FAULT_PART := ‘油中局部放电’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘YHZZJBFD’
)
THEN :NEW.FAULT_PART := ‘油和纸中局部放电’;
ELSIF(
:NEW.FAULT_PART_ENG = ‘SCHYZQP’
)
THEN :NEW.FAULT_PART := ‘受潮或油中气泡’;
ELSE :NEW.FAULT_PART := ‘正常’;
END IF;
END;