Maybe I'm missing something, but it shouldn't matter what order the clauses
are in, unless they are combinations of AND and OR.

Why can't you just append the clause for each statment?

A bit more info would help too.  Are they 5 possible OR'ed values from a
column, are they full statements, are they subqueries?  Either way you
should be able to just append to the stock select clause.

Thor HW
----- Original Message -----
From: Joe Sam Shirah <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 22, 1999 4:24 PM
Subject: Re: Runtime Query


>     Hi Nimesh,
>
>     As the others have suggested, generally one would build the query
string
> dynamically, concatenating to the WHERE condition depending on what is
> selected.
>
>     I did want to mention a few other things to consider.
>
>     While there are 5! combinations, we generally aren't concerned with
all
> of them, only the unique sets without regard to order.  If there is a
> hierarchy that makes a difference, like Company, Cost Center, Department,
> Employee, one would expect the ComboBoxes to be set up or examined in
> that order.  So, choices 1234, 2341, 3412, 4123, 2413 and so on are the
> same to us.  Depending on the application, it may be worth while to
prepare
> statements for some or all of the unique sets.
>
>     The maximum case is always known, that is, if selections are made from
> all five possibilities, you can create and use a prepared statement for
that
> situation at least, while dynamically generating the others.
>
>     One other possibility for strings that I haven't tested and would
likely
> be DB dependent, is to use one dynamically generated statement with
> LIKE and insert  '%' for unselected items.  Depending on the DB engine,
this
> could well be optimized away as everything would match for that column.
The
> standard states the % will match any sequence of ZERO or more characters.
> No guarantees, but it is probably worth some test runs for statistics
 and
> let us know if you do. )
>
>
>                                             Joe Sam Shirah
>                                             Autumn Software
>
>
> -----Original Message-----
> From: Kenia Nimesh <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Saturday, August 21, 1999 10:31 AM
> Subject: Runtime Query
>
> > I have around 5 comboboxes.The user has option of selecting the
> >comboboxes in all combinations and permutations.I fire a database query
> >with parameters that the user selects in the given comboboxes.
> > So if the user selects values from all the comboboxes then in my select
> >statement I will have five parameters in the where clause. If the user
> >selects four the four parameters in the where clause.
> > So in all it turns out to be 5* 4 * 3 * 2 * 1 combinations.
> > How should I handle this situation.I am using Oracle as my Database
> >Server.
> >
> > thanks in Advance
> > Nimesh Kenia
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to