---
title: "关于oracle外连接的问题"
author: "weibaojun"
date: "2008-07-28T18:18:28Z"
tags: ["F#", "Oracle", "SQL"]
slug: "oracle"
draft: false
lastmod: "2008-07-28T18:18:28Z"
id: 220709
url: "https://weibaojun.iteye.com/blog/220709"
---

我写了一个sql如下：

```
select *
  from storage_market_fetch          f,
       storage_market_fetch_mat      m,
       storage_mar_fetch_collect_mat fm
 where f.fetch_bill_id = m.fetch_bill_id
   and m.mat_info_id = fm.mat_info_id(+)
   and f.is_deleted = 0
   and f.is_returned = 0
   and f.step = 9
   and fm.mat_info_id is null
   and m.pay_price is not null
```

我现在需要在fm表中加一个条件，就是加fm.is\_disabled = 0这样一个条件，如果直接加在where条件的后面，是不行的，那么除了先查询记录再外连接的这种方法外，还有没有其他的方法，我这样写对不对，请高手指点一下。

```
select *
  from storage_market_fetch          f,
       storage_market_fetch_mat      m,
       storage_mar_fetch_collect_mat fm
 where f.fetch_bill_id = m.fetch_bill_id
   and m.mat_info_id = fm.mat_info_id(+)
   and f.is_deleted = 0
   and f.is_returned = 0
   and f.step = 9
   and fm.is_disabled(+) = 0
   and fm.mat_info_id is null
   and m.pay_price is not null
```

  就是在连接条件中加了and fm.is\_disabled(+) = 0的条件，不知道对不对。