zoukankan      html  css  js  c++  java
  • 意外报错的出发器

    show triggers;
    drop trigger pyb_tk_exam_subject_set
    delimiter
    ////////此方法是错误的,刚刚插入的当前行,不能用update会造成死循环
    ////////操作其它表,用update ,操作当前表用 before set
    create trigger pyb_tk_exam_subject_set after update on pyb_tk_exam_subject for each row
    begin
      if (NEW.child_num > 0 and NEW.score > 0) then
        update pyb_tk_exam_subject set totalscore = child_num * score where ID = NEW.ID;
      end if;
    end;
    ////////此方法是错误的,刚刚插入的当前行,不能用update会造成死循环,请修改 注意: ===before
    ////////此方法是错误的,刚刚插入的当前行,不能用update会造成死循环,请修改 注意: ===before
    ////////此方法是错误的,刚刚插入的当前行,不能用update会造成死循环,请修改 注意: ===before
    create trigger pyb_tk_exam_subject_set before update on pyb_tk_exam_subject for each row
    begin
      if (NEW.child_num > 0 and NEW.score > 0) then
        set NEW.totalscore=NEW.child_num * NEW.score;
      end if;
    end;

    //////例子二
    create trigger pyb_tk_exam_test_record_set before update on pyb_tk_exam_test_record for each row
    begin
      if (NEW.eid >0) then
        set NEW.topid=(select topid from pyb_tk_exam_test where pyb_tk_exam_test.id=NEW.eid);
        set NEW.fid=(select fid from pyb_tk_exam_test where pyb_tk_exam_test.id=NEW.eid);
        set NEW.cid=(select cid from pyb_tk_exam_test where pyb_tk_exam_test.id=NEW.eid);
      end if;
    end;

  • 相关阅读:
    DVWA系列のSQL注射
    DVWA系列のCSRF&文件包含
    PHPSTORM+Xdebug配置
    Django 从入门到忘记学习笔记
    <双十一特辑> 模拟登录学校教务处爬取全校女生资料和头像
    zzcms7.2漏洞挖掘学习
    laravel5.3搭建过程中出现问题
    kali-linux简单学习
    linux学习二(小随笔)
    linux学习一
  • 原文地址:https://www.cnblogs.com/thinkbig/p/10136952.html
Copyright © 2011-2022 走看看