Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 Oracle PL/SQL: WITH Clause: Double alias Jump to:  
Category: >> Oracle PL/SQL >> WITH Clause: Double alias Bookmark and Share

<< lastnext >>

Snippet Name: WITH Clause: Double alias

Description: The WITH query_name clause provides a way assign a name to a subquery block. The subquery block can then be referenced in multiple places in the query by specifying the query name. The query is optimized by treating it as either an inline view or as a temporary table.

Also see:
» AND Condition
» Distinct
» Having Clause
» EXISTS 2
» EXISTS
» WITH with CONNECT BY
» WITH Clause: Single alias

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: February 26th, 2009

WITH <alias_one> AS 
     (subquery_sql_statement)
          <alias_two> AS
     (sql_statement_from_alias_one)
SELECT <column_name_list>
FROM <alias_one>, <alias_two>
WHERE <join_condition>;
 
WITH RT1 AS
     (SELECT inst_id FROM gv$session),
          RT2 AS
     (SELECT UNIQUE inst_id FROM RT1
     UNION ALL
     SELECT UNIQUE inst_id FROM RT1)
SELECT /*+ MATERIALIZE */ *
FROM RT1, RT2
WHERE RT1.inst_id = RT2.inst_id;


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 44 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?