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 -> Re: How to avoid a temporary table

Re: How to avoid a temporary table

From: tojo <Tojo_at_hotmail.com>
Date: Thu, 23 Oct 2003 15:14:31 +0200
Message-ID: <MPG.1a01f275288755fd9896bc@news.t-online.de>


In article <9769adc8.0310230450.4a46090d_at_posting.google.com>, plm_at_gmx.li says...
> Hello,
>
> Often I have seen opinions in this group that temporary tables are not
> necessary and can always be avoided. I don't like (the oracle way of)
> temporary tables and would like to avoid them, if possible. However I
> feel that often they are unavoidable in order to "modularize" SQL,
> i.e. avoid multiple occurrance of similar pieces of SQL.
>
> I know that you can always rewrite a temporary table as a subquery.
> Often however, you end up using multiple subqueries that are very
> similar, i.e. duplication of "code", that you avoid in "normal"
> programming languages by using subfunctions that calculate
> intermediate results and store these.
>
> Am I missing some approach or method to avoid code duplication without
> resorting to temporary tables?
>

Oracle 9i has the new WITH clause for SQL, which lets you modularize repeating SELECTS. Search the SQL docs for "subquery_factoring_clause", it should help.

Received on Thu Oct 23 2003 - 08:14:31 CDT

Original text of this message

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