Home » SQL & PL/SQL » SQL & PL/SQL » Different way of writing OR condition (Oralce 11 g)
Different way of writing OR condition [message #642330] Tue, 08 September 2015 04:40 Go to next message
na.dharma@gmail.com
Messages: 82
Registered: May 2008
Location: bangalore
Member

How to write this below condition in different ways

Mainly I want to avoid OR condition, why because OR is causing performance issue

AND ( (cris_user_access = 'GLOBAL_USER' AND fscr.netting_secrecy_rule_key != -910) OR (cris_user_access != 'GLOBAL_USER'))

Re: Different way of writing OR condition [message #642331 is a reply to message #642330] Tue, 08 September 2015 04:50 Go to previous messageGo to next message
Michel Cadot
Messages: 68647
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Anyway, you will write it will be an OR.
The optimizer rewrite the conditions in a canonical way for it.
Anyway you will write it, if these ways are equivalent, they will rewritten to the same thing by the optimizer.

Note that "( A and B ) or !A" is equivalent to "B or !A" (ignoring the NULL).

[Updated on: Tue, 08 September 2015 04:52]

Report message to a moderator

Re: Different way of writing OR condition [message #642334 is a reply to message #642331] Tue, 08 September 2015 05:06 Go to previous message
Flyby
Messages: 188
Registered: March 2011
Location: Belgium
Senior Member
You could use Union instead of or. In a rare occasion it improved the query plan

Previous Topic: Data Function help
Next Topic: How to display employee table information based on salary in different ranges
Goto Forum:
  


Current Time: Fri Apr 26 22:41:07 CDT 2024