zoukankan      html  css  js  c++  java
  • 正在执行的SQL和之前执行的SQL

    SQL> select * from v$mystat where rownum<2;
    
           SID STATISTIC#	   VALUE
    ---------- ---------- ----------
          1996	    0	       0
    
    SQL> select count(*), USERNAME from v$session group by username;
    
      COUNT(*) USERNAME
    ---------- ------------------------------
    	25
    	13 CZCB
    	 1 SYS
    ----之前执行的SQL
    SQL> select sql_text
      from v$sqlarea
     where (address, hash_value) in
           (select prev_sql_addr, prev_hash_value
              from v$session
             where sid = '1996')
      2    3    4    5    6    7  ;
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    select count(*), USERNAME from v$session group by username
    
    
    ----正在执行的SQL
      SQL>   select sql_text
              from v$sqlarea
             where (address, hash_value) in
                   (select SQL_ADDRESS, SQL_HASH_VALUE
                      from v$session
                     where sid = '1996');  2    3    4    5    6  
    
    no rows selected
    
    
    
     测试2:
    SQL> select count(*) from T_PM_ACCT_DTL_AF;
    SQL>  select sql_text
      from v$sqlarea
     where (address, hash_value) in
           (select prev_sql_addr, prev_hash_value
              from v$session
             where sid = '1996')
      2    3    4    5    6    7  ;
    
    SQL_TEXT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      select sql_text	    from v$sqlarea	    where (address, hash_value) in		  (select SQL_ADDRESS, SQL_HASH_VALUE			from v$session			where sid = '199
    6')
    
    
    SQL> select sql_text
              from v$sqlarea
             where (address, hash_value) in
                   (select SQL_ADDRESS, SQL_HASH_VALUE
                      from v$session
                     where sid = '1996');  2    3    4    5    6  
    
    SQL_TEXT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    select count(*) from T_PM_ACCT_DTL_AF

  • 相关阅读:
    UVa 1605
    UVa 120
    UVa 10384
    UVa 11694
    UVa 11846
    常用小函数
    【DP】:CF #319 (Div. 2) B. Modulo Sum
    类的无参方法
    类和对象
    七言
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/3797971.html
Copyright © 2011-2022 走看看