アプリ版:「スタンプのみでお礼する」機能のリリースについて

外部結合で、"AND"の他に"OR"文も使用したいと思います。
しかし、それを実行すると構文エラーになってしまします。
どうしたら上手く出来るのでしょうか?
宜しくお願い致します。
ちなみに、Oracle8iを使用しています。

SELECT test_tbl.tanto_cd,test_tbl.tanto_name,
test_tbl.tanto_filecd,test_tbl.tanto_filename
FROM test_tbl, test_tbl2
where
test_tbl.tanto_cd(+) = test_tbl2.tanto_cd
and tanto_filename like '%名%'
or test_tbl.tanto_cd = '0000001';

上記のselect文を流すと
4行でエラーが発生しました。
ORA-01719: OR句またはIN句の中で外部結合は使用できません。
と出てしまいます。

A 回答 (2件)

SELECT test_tbl.tanto_cd,test_tbl.tanto_name,


test_tbl.tanto_filecd,test_tbl.tanto_filename
FROM test_tbl, test_tbl2
where
test_tbl.tanto_cd(+) = test_tbl2.tanto_cd
and (tanto_filename like '%名%'
or test_tbl.tanto_cd = '0000001');

SELECT test_tbl.tanto_cd,test_tbl.tanto_name,
test_tbl.tanto_filecd,test_tbl.tanto_filename
FROM test_tbl, test_tbl2
where
(test_tbl.tanto_cd(+) = test_tbl2.tanto_cd
and tanto_filename like '%名%')
or (test_tbl.tanto_cd(+) = test_tbl2.tanto_cd
and test_tbl.tanto_cd = '0000001');
でしょう。
    • good
    • 0
この回答へのお礼

おかげさまで、上手く行きました。
どうもありがとうございました。

お礼日時:2003/11/28 17:11

そしたら



SELECT * FROM
(SELECT test_tbl.tanto_cd,test_tbl.tanto_name,
test_tbl.tanto_filecd,test_tbl.tanto_filename
FROM test_tbl, test_tbl2
where
test_tbl.tanto_cd(+) = test_tbl2.tanto_cd)
WHERE tanto_filename like '%名%' or test_tbl.tanto_cd = '0000001';

としてみれば良いのではないでしょうか?
    • good
    • 0
この回答へのお礼

直ぐにお答え頂きありがとうございました。

お礼日時:2003/11/28 17:11

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!

関連するカテゴリからQ&Aを探す