若查询没有数据的时候,怎样做可以得到一条所有字段全为0 的数据

2024-12-04 07:24:17
推荐回答(2个)
回答1:

with t1 as (select id,num from t),
t2 as (select 0 id, 0 num)
select * from t1
union all
select * from t2 where (select count(*) from t1)=0

回答2:

判断如果没有查询到字段,返回
select '0' as XA,'0' as XB,..... from dual;