oracle的with可以有多个查询

oracle的with……as……后可以带多个查询,之间可用逗号分隔

 -- with……AS……带多个查询例

SQL> select * from v$version;

 

 BANNER

 -------------------------------------------------------------------------

 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

 PL/SQL Release 11.2.0.1.0 - Production

 CORE    11.2.0.1.0      Production

 TNS for 64-bit Windows: Version 11.2.0.1.0 - Production

 NLSRTL Version 11.2.0.1.0 - Production

 

 SQL>

SQL> with a as (select * from dual)
   2     ,b as (select * from dual)
   3  select * from a;
 
 D
 -
 X
 
注意环境是oracle11g,在10g及以下版本中,必须用到所有的查询。
 
-- 失败
with a as (select * from dual)
        ,b as (select * from dual)
     select * from a;
 
-- 成功
with a as (select * from dual)
        ,b as (select * from dual)
     select * from a,b;
 
没环境,不试了。
 
 
-- End --

你可能感兴趣的:(with,AS,可以带多个查询)