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 -> Does "WHERE 0=1" require a full table scan?

Does "WHERE 0=1" require a full table scan?

From: Wolfram Roesler <wr_at_grp.de>
Date: 30 Jan 2004 11:13:37 GMT
Message-ID: <Xns94807C6718D20wrgrpde@130.133.1.4>


Hi,

a simple question: For a query like "SELECT * FROM table WHERE 0=1", does Oracle do a full table scan, or does it optimize the query away and return nothing without accessing the table?

The background for this question is, I'm writing a C++ function that takes a column name and a list of strings and creates a WHERE clause to search for these strings, like "column IN ('string 1','string 2',...). In case of an empty list I want to create a WHERE clause that matches nothing, and I'm pondering whether "WHERE 0=1" or "WHERE column!=column" would be better.

Thanks for your help
Wolfram Roesler Received on Fri Jan 30 2004 - 05:13:37 CST

Original text of this message

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