å
¬å¸ç³»ç»éè¦,临æ¶éè¦æåä¸ä¸ªè§¦åå¨, æç®åçè®°å½äºä¸ä¸æç第ä¸ä¸ªè§¦åå¨çç¼åè¿ç¨.
第ä¸æ¥,æ¾é¨ååèèµæ,çæ大æ¦çé»è¾
第äºæ¥,åç
§èµæåèªå·±ç触åå¨é»è¾:
CREATE OR REPLACE TRIGGER update_bms_ord_recordAFTER UPDATE OF status ON oms.oms_orderFOR EACH ROW
BEGIN
CASE
WHEN UPDATING('status') THEN
IF :NEW.status='SIGN' THEN
UPDATE bms_ord_record ord SET ord.Be_Sign=1,ord.sign_time=:OLD.ACTUAL_RECEIVE_TIME WHERE ord.relatebill1=:old.relatebill1;ELSIF :OLD.status='SIGN'
UPDATE bms_ord_record ord SET ord.Be_Sign=0,ord.sign_time=NULL WHERE ord.relatebill1=:OLD.relatebill1;END IF;END CASE;
END;
åå®ä¸è¿°é»è¾åå¨sqlçªå£è¿è¡æ§è¡,æªæ¥ä»»ä½å¼å¸¸;第ä¸æ¥:æµè¯æåäºä¸ä¸ªupdateè¯å¥è¿è¡æµè¯,
UPDATE oms_order o SET o.status='SIGN2' WHERE o.relatebill1='50010777';ä½æ¯æ¥é,æå§ç»å¨æçplsqlä¸æ¥è¯¢ä¸å°æ触åå¨,æ£æ¥å¯¹åºçoms_order表,表ä¸ç¡®å®æ¯æ触åå¨ç.
åæ¢ç¨æ·å, å³å¯è½çå°èªå·±ç触åå¨, å¦ä¸å¾ç¹å»ç¼è¾,å°±å¯ä»¥å¨å³è¾¹çªå£ä¸é¢çå°ç¸åºçé误, æè
å次æ§è¡ä¸ä¸èæ¬, é误åºç°çå°æ¹ä¼æé»è²å
æ è¡åçæç» æ ¹æ®é误æ示,æ£æ¥ç¡®å®æ¯å¨ELSIF ç表达å¼åå°äºä¸ä¸ªç»å°¾ç then å
³é®å, å ä¸å,å次è¿è¡ç¼è¯,没æä»»ä½é误æ示, æµè¯ææä¹æ¯ok .
温馨提示:内容为网友见解,仅供参考