.一般变量的写法: if (str_kind is not null) then l_str_kind := str_kind; v_wheresql := v_wheresql || ' and kind = :kind '; else l_str_kind :'; v_wheresql := v_wheresql || ' and 1 = :kind '; end if; .时间段的写法: if (dt_itstarttime is not null) then v_wheresql :=…
查询配件主数据表(tbl_part_base_info)的所有数据和配件是否有物料(物料表(tbl_material)中有配件主数据表的part_no,就表示有物料,反之,则表示没有物料),用sql中的case when...then...else...end来实现 第一种写法: select info.*,(case when material.part_no is null then '否' else '是' end) hasMaterial from tbl_part_base_info …