[20220317]補充完善TPT 顯示欄位列的指令碼.txt
[20220317]補充完善TPT 顯示欄位列的指令碼.txt
--//tpt僅僅有comm.sql顯示錶註解的指令碼,沒有顯示欄位註解的指令碼。在原始的comm.sql指令碼增加查詢欄位的內容。
--//另外指令碼支援模糊查詢,查詢最好規避它,不然輸出太多。
$ cat colcomm.sql
-- Copyright 2018 Tanel Poder. All rights reserved. More info at
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
prompt Not listing tables without comments...
prompt Input argument owner.table_name column or owner.table_name ''
COLUMN comm_comments HEADING COMMENTS FORMAT a120 WORD_WRAP
COLUMN comm_owner HEADING OWNER FORMAT A20 WRAP
COLUMN comm_table_name HEADING TABLE_NAME FORMAT A30
COLUMN comm_column_name HEADING COLUMN_NAME FORMAT A30
SELECT
owner comm_owner
, table_name comm_table_name
, comments comm_comments
FROM
all_tab_comments
WHERE
comments is not null
AND
upper(table_name) LIKE
upper(CASE
WHEN INSTR('&1','.') > 0 THEN
SUBSTR('&1',INSTR('&1','.')+1)
ELSE
'&1'
END
) ESCAPE '\'
AND owner LIKE
CASE WHEN INSTR('&1','.') > 0 THEN
UPPER(SUBSTR('&1',1,INSTR('&1','.')-1))
ELSE
user
END ESCAPE '\'
/
SELECT
owner comm_owner
, table_name comm_table_name
, column_name comm_column_name
, comments comm_comments
FROM
all_col_comments
WHERE
comments is not null
AND
upper(table_name) LIKE
upper(CASE
WHEN INSTR('&1','.') > 0 THEN
SUBSTR('&1',INSTR('&1','.')+1)
ELSE
'&1'
END
) ESCAPE '\'
AND owner LIKE
CASE WHEN INSTR('&1','.') > 0 THEN
UPPER(SUBSTR('&1',1,INSTR('&1','.')-1))
ELSE
user
END ESCAPE '\'
and column_name like '%'||nvl(upper('&2'),column_name)||'%'
/
--//輸出例子如下:
SYS@book> @ colcomm sys.DBA_TAB_MODIFICATIONS name
Not listing tables without comments...
OWNER TABLE_NAME COMMENTS
-------------------- ------------------------------ ----------------------------------------------------------
SYS DBA_TAB_MODIFICATIONS Information regarding modifications to tables
OWNER TABLE_NAME COLUMN_NAME COMMENTS
-------------------- ------------------------------ ------------------------------ ---------------------------
SYS DBA_TAB_MODIFICATIONS TABLE_NAME Modified table
SYS DBA_TAB_MODIFICATIONS PARTITION_NAME Modified partition
SYS DBA_TAB_MODIFICATIONS SUBPARTITION_NAME Modified subpartition
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2884078/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20220510]完善tpt expandz.sql指令碼.txtSQL指令碼
- [20211130]完善tpt t.sql指令碼.txtSQL指令碼
- [20220823]完善tpt的ashtop.sql指令碼.txtSQL指令碼
- [20231025]完善tpt的trans.sql指令碼.txtSQL指令碼
- [20211129]完善tpt tablist.sql指令碼.txtSQL指令碼
- [20211129]完善tpt killi.sql指令碼.txtSQL指令碼
- [20220323]完善tpt get_trace.sql指令碼.txtSQL指令碼
- [20220217]完善tpt gts.sql指令碼.txtSQL指令碼
- [20211126]完善tpt pr.sql指令碼.txtSQL指令碼
- [20230302]建立完善tpt o2.sql指令碼.txtSQL指令碼
- [20220422]完善tpt ash ash_index_helperx指令碼2.txtIndex指令碼
- [20220111]完善tpt ashash_index_helper指令碼.txtIndex指令碼
- [20220129]完善tpt ash ash_index_helperx指令碼.txtIndex指令碼
- [20220519]完善tpt dash_wait_chains2.sql指令碼.txtAISQL指令碼
- [20211111]補充完善ash_wait_chains指令碼.txtAI指令碼
- [20170628]完善ooerr指令碼.txt指令碼
- [20240313]使用tpt ashtop.sql指令碼的困惑.txtSQL指令碼
- 補充行業程式碼欄位行業
- [20210506]完善tix指令碼.txt指令碼
- [20210407]完善ti.sql指令碼.txtSQL指令碼
- [20210623]完善清除aud指令碼.txt指令碼
- [20211223]tpt ash ash_index_helperx指令碼.txtIndex指令碼
- 輸出顯示豎指令碼指令碼
- [20201202]完善sosi指令碼.txt指令碼
- redis裡顯示key大小的shell指令碼Redis指令碼
- [20230510]測試使用tpt ddl指令碼是否產生日誌.txt指令碼
- [20211230]完善sql_id指令碼.txtSQL指令碼
- [20221010]完善descz.sql指令碼.txtSQL指令碼
- [20221101]完善descz.sql指令碼.txtSQL指令碼
- [20221101]完善gts.sql指令碼.txtSQL指令碼
- [20211122]完善descx.sql指令碼.txtSQL指令碼
- [20230414]完善seg2.sql指令碼.txtSQL指令碼
- [20231117]完善ashtt.sql指令碼.txtSQL指令碼
- [20230203]完善awr.sql指令碼.txtSQL指令碼
- [20211011]計算sql_id.sh指令碼的一些補充.txtSQL指令碼
- [20231101]使用tpt seg2.sql指令碼問題.txtSQL指令碼
- [20221126]tpt pr.sql指令碼執行問題.txtSQL指令碼
- [20221012]完善spsw.sql指令碼.txtSQL指令碼