Actually, 1=1 can do harm. If it is used in a join condition in outer join, the CBO cannot rewrite to (+) syntax and this limits its choice of join paths. This is not limited to "1=1", other conditions where the second table is not involved are affected as well (ie. when there is nothing where to put the "(+)").
I hit this on 10.2, and the disastrous results of 1=1 manifest even in 11.2.0.1. (See http://vitspinka.blogspot.com/2009/07/latteral-view-quirk.html for an example.)
Vit Dne 4.5.2011 16:46, Ric Van Dyke napsal(a):
Roger that. That *IS* where it's useful as a place holder, but nothing more. The good old programming "sub", like writing a PL/SQL procedure with just BEGIN NULL; END; As the code, it's there and a call to the procedure will always work, because it does nothing! And it runs really fast too! But would adding a "NULL" to the top of every PL/SQL block make it run faster? I think we can all agree that it wouldn't, and logically that is about the same thing that adding 1=1 to your query. ----------------------- Ric Van Dyke Hotsos Enterprises Cell 248-705-0624 ----------------------- The 10th Hotsos Symposium 4-8 March 2012 Start making plans now!
-- //www.freelists.org/webpage/oracle-l