解決済みの質問

外部結合での"OR"文

外部結合で、"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句の中で外部結合は使用できません。
と出てしまいます。

投稿日時 - 2003-11-28 16:40:57

連想キーワード:

QNo.717163

すぐに回答ほしいです

質問者が選んだベストアンサー

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');
でしょう。

投稿日時 - 2003-11-28 16:44:11

お礼

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

投稿日時 - 2003-11-28 17:11:44

ANo.1

0人が「このQ&Aが役に立った」と投票しています

[  前へ  |  次へ ]

ベストアンサー以外の回答(1件中 1~1件目)

ANo.2

そしたら

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';

としてみれば良いのではないでしょうか?

投稿日時 - 2003-11-28 16:45:45

お礼

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

投稿日時 - 2003-11-28 17:11:21

あわせてチェックしたい
  • ORA-1403 ...
  • ORA-06502のエラー ...
  • \'xjis.nls\' ...
PR

OKWaveのオススメ

教えて弁護士さん!

お金の悩みQ&A特集はこちら