MENU

Oracle一些技巧

April 1, 2022 • 默认分类

1、exists和not exists

// exists引导的子句只要有结果集返回,exists这个条件就算成立
select * from tb_menu m1
where exists (select 1 from tb_menu m2 where m1.parent=m2.parent)

2、Oracle 树操作(select…start with…connect by…prior)

select {t.*} from t_wf_ndealtype t where t.status=1 connect by nocycle prior t.typ_id=t.par_id start with t.par_id=? order by t.typ_code_full