Nevermind, I found what I was looking for.

*Computation Using the WITH Clause

The WITH clause (formally known as subquery_factoring_clause) enables
you to reuse the same query block in a SELECT statement when it occurs
more than once within a complex query. WITH is a part of the SQL-99
standard. This is particularly useful when a query has multiple
references to the same query block and there are joins and
aggregations. Using the WITH clause, Oracle retrieves the results of a
query block and stores them in the user's temporary tablespace. Note
that Oracle Database does not support recursive use of the WITH
clause.

The following query is an example of where you can improve performance
and write SQL more simply by using the WITH clause. The query
calculates the sum of sales for each channel and holds it under the
name channel_summary. Then it checks each channel's sales total to see
if any channel's sales are greater than one third of the total sales.
By using the WITH clause, the channel_summary data is calculated just
once, avoiding an extra scan through the large sales table....
http://download.oracle.com/docs/cd/B28359_01/server.111/b28313/aggreg.htm#i1007192


more examples here:
http://www.psoug.org/reference/with.html



On Fri, Sep 12, 2008 at 9:59 AM, Joel <[EMAIL PROTECTED]> wrote:
>
> I've seen several posts using select syntax similar to this:
>
>  with mytab as
>  (select * sometable)
>  select *
>  from mytab
>
> as opposed to this:
>
>  select *
>  from (select * from sometable)
>
>
> Does the structure of the 1st query have a certain name - what
> keywords would I use when doing a search for the advantages/
> disadvantages of the "with mytab as..." syntax?
>
> Thanks
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to