create view v as select A ,B ,(case when B=0 then 0 else A/B end) as 'C' from 表
create table div ( a float, b float)insert into div select 5,2 union all select 3,0 union all select 4,2 union all select 3,1create view v_div as select a,b, case b when 0 then 0 else a/b end as c from divselect * from v_div 結果: a b c ------------------------------- ------------------------------------------------ 5.0 2.0 2.5 3.0 0.0 0.0 4.0 2.0 2.0 3.0 1.0 3.0
sorry 結果: a b c 5.0 2.0 2.5 3.0 0.0 0.0 4.0 2.0 2.0 3.0 1.0 3.0
create view v as select A ,B ,(case when B=0 then 0 else A/B end) as 'C' from 表
as
select A
,B
,(case when B=0 then 0 else A/B end) as 'C'
from 表
( a float,
b float)insert into div
select 5,2 union all
select 3,0 union all
select 4,2 union all
select 3,1create view v_div
as
select a,b,
case b
when 0 then 0
else a/b end as c
from divselect * from v_div
結果:
a b c
------------------------------- ------------------------------------------------
5.0 2.0 2.5
3.0 0.0 0.0
4.0 2.0 2.0
3.0 1.0 3.0
a b c
5.0 2.0 2.5
3.0 0.0 0.0
4.0 2.0 2.0
3.0 1.0 3.0
as
select A
,B
,(case when B=0 then 0 else A/B end) as 'C'
from 表