Skip to Main Content

Japanese

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

from句でのCASE文の使用について

1009094May 15 2013 — edited May 17 2013
現在引数の条件によりfrom句が動的に変わるSQLの構築をしなければいけないのですが、動的SQLを用いるのではなく
CASE文を使用しfromに定義する取得元のテーブルを変更することは可能でしょうか?

実現したいのは
select
CASE when 引数.A is not NULL THEN
TBL_A.Column1
END
CASE when 引数.B is not NULL THEN
TBL_B.Column1
END
TBL_C.Column1
from
CASE when 引数.A is not NULL THEN
TBL_A
END
CASE when 引数.B is not NULL THEN
TBL_B
END
,TBL_C
のようなイメージでfrom句を条件により変えるというものです。
動的に文字列として実現できることはわかっているのですが、既存資産を流用したいため、CASE文が使用できないのかを
模索しています。

どうぞよろしくお願いします。
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 14 2013
Added on May 15 2013
4 comments
10,651 views