MySQL Forums
Forum List  »  Oracle

triggers from oracle to mysql
Posted by: AbdulWahid Zaydi
Date: June 27, 2007 03:21AM

I intended to migrate from oracle to mysql. for tables converting I don't have problem but I have three triggers which are essential in my application . these triggers are listed below:
1:
TRIGGER PROJECT_T1 BEFORE INSERT ON PROJECT
FOR EACH ROW
begin
UPDATE PROJECT
SET PROJECT.PROJECT_STATUS = 'Open'
where
ACTUAL_FINISH IS NULL;
UPDATE PROJECT
SET PROJECT.PROJECT_STATUS = 'Close'
where
ACTUAL_FINISH IS NOT NULL;

end;
___________________________________
2:
TRIGGER TASK_INS_TRIG BEFORE INSERT ON TASK
FOR EACH ROW
begin select TASK_TASKNO.nextval into :new.SERIAL_NUMBER from dual; end;
_____________________________________
3:
TRIGGER TASK_T1 BEFORE INSERT ON TASK
FOR EACH ROW
begin
select sysdate into :new.TASK_TIME from dual;
IF :new.TASK_NAME = 'Permissions' AND :new.STATUS = 'Start' THEN
UPDATE PROJECT
SET PROJECT.ACTUAL_START = :new.TASK_TIME
WHERE PROJECT.PROJECT_NUMBER = :new.PROJECT_NUMBER;
ELSIF :new.TASK_NAME = 'Ready for service' AND (:new.STATUS = 'Start' OR :new.STATUS = 'Finish') THEN
UPDATE PROJECT
SET PROJECT.ACTUAL_FINISH = :new.TASK_TIME
WHERE PROJECT.PROJECT_NUMBER = :new.PROJECT_NUMBER;
END IF;
end;

please how can I convert these triggers to mysql

Options: ReplyQuote


Subject
Views
Written By
Posted
triggers from oracle to mysql
9288
June 27, 2007 03:21AM
3382
May 23, 2008 07:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.