トップ 一覧 検索 ヘルプ RSS ログイン

Oracle/SQL-Tipsの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
{{category Tips}}
!!!SQL Tips
!!テーブルカラム名取得
 select
     to_char(rownum, 'fm000') seq
   , v.*
 from 
   (
     select 
         tables.table_name
       , comments.comments 
     from 
       user_tables tables
       inner join user_tab_comments comments
          on tables.TABLE_NAME = comments.TABLE_NAME
       inner join user_col_comments colcomments
          on tables.TABLE_NAME = colcomments.TABLE_NAME
     group by
         tables.table_name
       , comments.comments 
     order by 1
   ) v

!!プロセスからのSQL表示
 select
   S.SID, P.SPID, Q.SQL_TEXT
 from
   V$SQLTEXT Q, V$SESSION S, V$PROCESS P
 where S.PADDR = P.ADDR
   and S.SQL_ADDRESS = Q.ADDRESS
   and P.SPID = ?  --<<--  プロセスID
 --and  S.SID IN ? -- SID
 order by S.SID, Q.PIECE;

!!Links
*[Oracle 豆辞典 |http://www.venus.dti.ne.jp/~yoshi-o/RDB/Oracle-Beans_dictionary.html]
*[Oracle Tips|http://www.occn.zaq.ne.jp/maekawa/oracletip/]

{{category Oracle}}
!!!テーブルカラム名取得
select
    to_char(rownum, 'fm000') seq
  , v.*
from 
  (
    select 
        tables.table_name
      , comments.comments 
    from 
      user_tables tables
      inner join user_tab_comments comments
         on tables.TABLE_NAME = comments.TABLE_NAME
      inner join user_col_comments colcomments
         on tables.TABLE_NAME = colcomments.TABLE_NAME
    group by
        tables.table_name
      , comments.comments 
    order by 1
  ) v