Re: conditional selection of 'AND' or 'Select' in Oracle

From: Jan Gelbrich <j_gelbrich_at_westfalen-blatt.de>
Date: Mon, 19 Apr 2004 08:22:19 +0200
Message-ID: <c5vrde$67j08$1_at_ID-93924.news.uni-berlin.de>


"Rohit Dhawan" <rohit_reborn_at_yahoo.com> schrieb im Newsbeitrag news:c76d1c78.0404161545.550a50cb_at_posting.google.com...
> I am working on Oracle reports . One of the parameters that a User
> inputs is
> 'report_type'. Now, is there a way to do the following within a SQL
> query with no use of procedures or functions.
>
> select blaa from foo where
>
> something = something
> // if report_type='some_data' then
> and somethingelse = something else
> //else do nothing
>
>
> Also, IS there a way of doing something like the following
>
> // if report_type='some_data' then
>
> select blaa from foo where
> something = something
> // if report_type='some_data' then
> and somethingelse = something else
> //else do nothing
>
> else
> select blass1 from foo where
> something = something
> // if report_type='some_data' then
> and somethingelse = something else
> //else do nothing

Try something like this:

  1. Query: - Make a placeholder qp_where_condition - and then transform your query:

select blah
from blubb
&qp_where_condition

2. Before Report Trigger:

bunch of code...
...
IF condition1 THEN --Also You may use CASE ...

   :qp_where := 'WHERE something = a and so on' ELSE ...
... more code ...

hth, Jan Received on Mon Apr 19 2004 - 08:22:19 CEST

Original text of this message