Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help Needed - Varying Input Problem

Re: Help Needed - Varying Input Problem

From: sybrandb <sybrandb_at_gmail.com>
Date: Thu, 07 Jun 2007 04:20:06 -0700
Message-ID: <1181215206.155722.295930@q75g2000hsh.googlegroups.com>


On Jun 7, 12:07 pm, "pankaj_wolfhun..._at_yahoo.co.in" <pankaj_wolfhun..._at_yahoo.co.in> wrote:
> Greetings,
>
> The requiremnt gathers a set of inputs from from end and based on
> these input conditions we have to fetch values from our db tables.
>
> Preety simple but the problem here is the inputs are not fixed.
>
> Say in all, we have 10 inputs in our front end but the user only
> selects 5 of them or may be 2 or all 10.
>
> How should I build by query so it takes all the valid inputs.
>
> One way is so use a set of if...else. But is there any other
> alternative?
> Can I use case statement here? Can I achieve this in a single
> statement?
>
> Any help would be appreciated.
>
> We are using Oracle 9i.
>
> TIA
You are a bit vague, aren't you? What are these inputs? Numbers? Dates? Or just varchar2s?
Simple literals?
When varchar2s, just <column> like yourinput||'%' works quite nicely even if the input is null.
Further than that adding a dummy clause like '1=1' makes sure you don't have to worry about unconstrained queries.

--
Sybrand Bakker
Senior Oracle DBA
Received on Thu Jun 07 2007 - 06:20:06 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US