Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> "WHERE 1 = 2" does strange things
"WHERE 1 = 2" is a known trick to clone table structure. It should
create an empty table. It should work very fast.
IT DOES NOT. At least when cloning a structure of a view.
Try it and look at explain plan. For some reason, even if it should be absolutely clear to ORACLE optimizer that no rows ought to be return, it still scans indexes of the tables forming the view. On complex views with large tables this turns out to be a costly process.
Does anybody know more effective method to clone structure of a view into a new table? Received on Wed Sep 28 2005 - 09:43:02 CDT