sybn sybn-util 项目说明文档 - 基于java的跨数据库联合查询

对if语句的支持

2022-11-08
sybn

本工具包支持接近sql风格的 if 语句, 实际对于 if 语句的支持如下:

if [not] exists (select code from xxx) [then (select 1)] [else (select 2)] [end if]

  • 仅 then 举例
    if exists (select code from xxx) then (select 1) end if
    if exists (select code from xxx) then (select 1)
    if exists (select code from xxx) then select 1
    if not exists (select code from xxx) then (select 1) end if
    if not exists (select code from xxx) then (select 1) 
    if not exists (select code from xxx) then select 1
    
  • 仅 else 举例
    if exists (select code from xxx) else (select 2) end if
    if exists (select code from xxx) else (select 2)
    if exists (select code from xxx) else select 2
    if not exists (select code from xxx) else (select 2) end if
    if not exists (select code from xxx) else (select 2)
    if not exists (select code from xxx) else select 2
    
  • 同时 then 和 else 举例
    if exists (select code from xxx) then (select 1) else (select 2) end if
    if exists (select code from xxx) then (select 1) else (select 2)
    if not exists (select code from xxx) then (select 1) else (select 2) end if
    if not exists (select code from xxx) then (select 1) else (select 2)
    

Similar Posts

Comments

暂不开放评论! 可微信联系