select  csdl.delivery_number, nvl((select  av.name from supliers av where av.seg = '1000'),
  (select vl.description    from  FND_FLEX vl where  vl.SET_ID = '1013717' and vl.ENABLED = 'Y'and vl.MEANING ='10'))
destination   from cux_delivery_list  csdl 是这个意思吧

解决方案 »

  1.   

    select  csdl.delivery_number, case when not exists(select  1 from supliers av where av.seg = '1000') then
      (select vl.description    from  FND_FLEX vl where  vl.SET_ID = '1013717' and vl.ENABLED = 'Y'and vl.MEANING ='10')
    else
    (select  av.name from supliers av where av.seg = '1000')
    end
    destination   from cux_delivery_list  csdl 
      

  2.   

    select vl.description    from  FND_FLEX vl where  vl.SET_ID = '1013717' and vl.ENABLED = 'Y'and vl.MEANING ='10'
     and not exists(select  1  from supliers av where av.seg = '1000')
    A中不存在记录的时候执行B
      

  3.   

    create or replace view cux_shipment_delivery_list_v as
    select  csdl.delivery_number, (select  av.name from supliers av where av.seg = '1000')destination   from cux_delivery_list  csdl 
    where exists (select  av.name from supliers av where av.seg = '1000')
    union all
    select  csdl.delivery_number, (select vl.description  from  FND_FLEX vl where  vl.SET_ID = '1013717' and vl.ENABLED = 'Y'and vl.MEANING ='10')destination   from cux_delivery_list  csdl 
    where not exists (select  av.name from supliers av where av.seg = '1000')