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

Home -> Community -> Usenet -> c.d.o.server -> Re: help with multiple BETWEEN statements

Re: help with multiple BETWEEN statements

From: Yvonne G <hlngus_at_hotmail.com>
Date: 13 Jan 2003 10:14:03 -0800
Message-ID: <d999b872.0301131014.4a43d9f6@posting.google.com>


Sybrand Bakker <gooiditweg_at_nospam.demon.nl> wrote in message news:<v8k42vopjicl7tpr8d28lh5iosp97f1nmd_at_4ax.com>...
> On 12 Jan 2003 21:04:14 -0800, hlngus_at_hotmail.com (Yvonne G) wrote:
>
> >thanks to those for correcting me:
> >
> >however, when there is only 1 between statement the query comes back
> >quickly.
> >
> >when there are multiple OR clauses, the query just hangs and eats up
> >system resources. What is happening?
> >
> >SELECT A from table1
> >> where rate = 'abc'
> >> and code between '0100' and '0199'
> >> OR code between '4000' and '4499'
> >
> >thanks again.
>
>
> Mathematically a AND has a higher priority than OR
> Try putting parentheses around the various conditions
>
> and (code between '0100' and '0199') or (code between '4000' and
> '4499')
> I have seen awful results by not doing this.
> You might also want to apply the /*+ USE_CONCAT */ hint in your query,
> this will make sure you will the ORs dealt with as multiple query
> blocks.
>
> Hth
>
>
> Sybrand Bakker, Senior Oracle DBA
>
> To reply remove -verwijderdit from my e-mail address

Thanks for the input; I've tried putting liberal parentheses as per the following snippet, to no avail:

AND   ADORDER.TYPE = 'C' 	 AND
	 ((((RUNINS.CLASS) Between ' 105' And ' 820'))
	 OR (((RUNINS.CLASS) Between '4010' And '4320')))

Anyone have additional suggestions? Received on Mon Jan 13 2003 - 12:14:03 CST

Original text of this message

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