1.     create table t (x int);  --创建测试表  
  2.     insert into t values(1);   
  3.     insert into t values(3);   
  4.     insert into t values(5);   
  5.     insert into t values(7);   
  6.     insert into t values(9);   
  7.     法一:  
  8.     select x  
  9.         from ( select x, rownum r  
  10.                  from ( select x from t order by x desc )  
  11.                         where rownum <= 2 )  
  12.        where r = 2;  
  13.     注释:子查询不进行扩展(unest),那么是先求出最里层的数据  
  14.     法二:  
  15.     select *     
  16.      from t     
  17.      where (select count(*)    
  18.      from t t2     
  19.      where t2.x > t.x ) = 1     
  20.      /   
  21.     注释:子查询中的条件跟其他高辈分的SELECT有关联(关联子查询) 
  22. 法三: 
  23. select max(x)  
  24.  from t  
  25.  where x < (select max(x) from t)  
  26.  / 
  27. 法四: 
  28. select x  
  29.  from ( select x, row_number() over ( order by x desc ) r  
  30.           from t  
  31.         )  
  32.  where r = 2  
  33. 注释:row_number() 是分析函数 
  34.  
  35.