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

Home -> Community -> Mailing Lists -> Oracle-L -> Re[2]: WHERE 1 = 1 (any info on this)

Re[2]: WHERE 1 = 1 (any info on this)

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: Tue, 21 Oct 2003 05:34:26 -0800
Message-ID: <F001.005D3DCA.20031021053426@fatcity.com>


Tuesday, October 21, 2003, 8:05:10 AM, Conner wrote:

CM> The most common cause I've seen for 1=1 is so when
CM> developers are building dynamic where-clause, they
CM> don't need to worry about adding 'where' versus 'and'
CM> to the sql string being constructed.

Here's another use for you to consider. I recently talked to someone who uses WHERE 1=1 for editing convenience. I asked him about it once, and he provided the following explanation:

    Just convenience in editing/reading. These queries are     not in a view, they are in a function inside a package,     which returns a REF CURSOR with the results to Java.     Since I use gvim to edit procedures and it has     auto-alignment and auto-repeat, I tend to make all my     predicates "and *" and use "where 1=1" for the only one     that is different. That also means I can cut-and-paste     entire predicate lines in gvim and always have them     conveniently aligned on the same word: "and".

Best regards,

Jonathan Gennick --- Brighten the corner where you are http://Gennick.com * 906.387.1698 * mailto:jonathan@gennick.com

Join the Oracle-article list and receive one article on Oracle technologies per month by email. To join, visit http://four.pairlist.net/mailman/listinfo/oracle-article, or send email to Oracle-article-request_at_gennick.com and include the word "subscribe" in either the subject or body.

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Jonathan Gennick
  INET: jonathan_at_gennick.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Oct 21 2003 - 08:34:26 CDT

Original text of this message

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