sql >> Base de Datos >  >> RDS >> Mysql

Conversión de disparador Oracle a disparador MySql

MySQL no usa los dos puntos, y hay algunas otras variaciones menores. Creo que esto funcionará:

DELIMITER $$

CREATE OR REPLACE TRIGGER PRE_DEL_LN_CLIENTS
BEFORE DELETE ON LN_CLIENTS
FOR EACH ROW
BEGIN
  INSERT INTO LN_CLIENTS_DELETED (REC_ID, LOAN_NUMBER, CLIENT_SEQ_NUM, FIRST_NAME, FATHER_NAME, FAMILY_NAME, MOTHER_NAME, NATIONALITY, SEX, BIRTH_PLACE_CODE, BIRTH_PLACE_TEXT, BIRTH_DATE, REG_PLACE_CODE, REG_PLACE_TEXT, REG_NUM, ADDRESS_CODE, ADDRESS_TEXT, PHONE, EDUCATION_LEVEL_CODE, PROFESSION_CODE, PROFESSION_TEXT, MONTHLY_INCOME, WORK_PLACE, WORK_ADDRESS_TEXT, ID_DOC_TYPE, ID_DOC_NUM1, ID_DOC_NUM2, ID_DOC_DATE, NOTES, OFFICE, CREATED_BY, CREATED_ON, UPDATED_BY, UPDATED_ON, SYNC_FLAG)
      VALUES(OLD.REC_ID, OLD.LOAN_NUMBER, OLD.CLIENT_SEQ_NUM, OLD.FIRST_NAME, OLD.FATHER_NAME, OLD.FAMILY_NAME, OLD.MOTHER_NAME, OLD.NATIONALITY, OLD.SEX, OLD.BIRTH_PLACE_CODE, OLD.BIRTH_PLACE_TEXT, OLD.BIRTH_DATE, OLD.REG_PLACE_CODE, OLD.REG_PLACE_TEXT, OLD.REG_NUM, OLD.ADDRESS_CODE, OLD.ADDRESS_TEXT, OLD.PHONE, OLD.EDUCATION_LEVEL_CODE, OLD.PROFESSION_CODE, OLD.PROFESSION_TEXT, OLD.MONTHLY_INCOME, OLD.WORK_PLACE, OLD.WORK_ADDRESS_TEXT, OLD.ID_DOC_TYPE, OLD.ID_DOC_NUM1, OLD.ID_DOC_NUM2, OLD.ID_DOC_DATE, OLD.NOTES, OLD.OFFICE, OLD.CREATED_BY, OLD.CREATED_ON, OLD.UPDATED_BY, OLD.UPDATED_ON, 'I');
END$$

DELIMITER ;