在sql中选择空值

时间:2012-12-19 14:22:33

标签: oracle plsql null

我有两张桌子

  1. xx_new.xx_online_registrations@appsread.prd.com oreg
  2. m_warranty_sku MSK
  3. 在oreg表中,我对字段ora_warranty_id有一些空值,但是在MSK表中我没有空值,所以当我加入这两个表时,oreg的空值列被过滤,有没有办法可以限制数据也是如此。我在下面做了qry,但不确定这是否正确。

    select *
    from
        (
        select 
       oreg.ora_warranty_id,
       mdh.warranty_sku_num
        from
         mdhdba.m_warranty_sku mdh
             , xx_new.xx_online_registrations@appsread.prd.com oreg
        where
       mdh.warranty_sku_num= oreg.ora_warranty_id(+) -----ora_warranty_id from  xx_new.xx_online_registration table
       )
    where ora_warranty_id is  null -- oreg.ora_warranty_id
    

1 个答案:

答案 0 :(得分:0)

希望这有帮助,

    select *
from
    (
    select 
   oreg.ora_warranty_id,
   mdh.warranty_sku_num
    from
     mdhdba.m_warranty_sku mdh
         , xx_new.xx_online_registrations@appsread.prd.com oreg
    where
   oreg.ora_warranty_id = mdh.warranty_sku_num(+) -----ora_warranty_id from  xx_new.xx_online_registration table
   )
where ora_warranty_id is  null -- oreg.ora_warranty_id