zoukankan      html  css  js  c++  java
  • sql中的begin....end

    Begin
    ...
    End
    之间的是一个语句块,一般Begin...End用在  ( 相当于  {})
    while
    if等语句中
    在T_SQL中,if/while后只能紧跟一条sql语句,如果有多条则应该用Begin..end包含起来
    如:
    if (@int > 9)
    set @int = 1
    else
    set @int = 0
    这里的if后面只把变量@int设为1,没有其它的操作,所以这里可以省去begin..end
    但如果有多条,如
    if(@int > 9)
    begin
    set @int = 1
    select * from tablename
    end
    这里就必须用begin..end
    否则
    select语句就永远都会被执行一次

    应用于mybatis  当有多个delete时 :

    <delete id="deleteHdsqByProcessinstid">

    BEGIN

    delete from wfworkitem c where c.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
    delete from wfactivityinst c where c.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
    delete from wftransctrl e where e.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
    delete from wftransition g where g.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
    delete from wfwiparticipant i where i.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);
    delete from wfprocessinst a where a.processinstid in (select b.processinstid from wfprocessinst b where b.PARENTPROCID=#processinstid#);

    delete from wfworkitem where processinstid=#processinstid#;
    delete from wfactivityinst where processinstid=#processinstid#;
    delete from wftransctrl where processinstid=#processinstid#;
    delete from wftransition where processinstid=#processinstid#;
    delete from wfwiparticipant where processinstid=#processinstid#;
    delete from wfprocessinst where processinstid=#processinstid#;
    END;
    </delete>

  • 相关阅读:
    我倾向于使用发布版本进行调试,而不是使用调试版本
    常见WinDbg问题及解决方案
    在崩溃转储中查找所有可能的上下文记录
    向C/C++程序员介绍Windbg 脚本
    VS 使用技巧(1)
    Windows资源监视器软件的原理
    微架构、指令集架构与汇编语言的关系
    调试寄存器 原理与使用:DR0-DR7
    如何学习调试?
    WinDbg: 执行 SOS 扩展命令 !clrstack时报错 Access violation exception (0xC0000005)
  • 原文地址:https://www.cnblogs.com/keyi/p/6961569.html
Copyright © 2011-2022 走看看