-
Notifications
You must be signed in to change notification settings - Fork 4
/
column_type.sql
38 lines (34 loc) · 1.1 KB
/
column_type.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--==============================================================================
-- GPI - Gunther Pippèrr
-- Desc: search all columns with this type in the database
-- Parameter 1: Type of the column
--
-- Must be run with dba privileges
--
--
--==============================================================================
set verify off
set linesize 130 pagesize 300
define OWNER = '&1'
define COL_TYPE = '&2'
prompt
prompt Parameter 1 = Owner Name => &&OWNER.
prompt Parameter 2 = Column Type => &&COL_TYPE.
prompt
column owner format a15 heading "Qwner"
column table_name format a25 heading "Table|Name"
column column_name format a20 heading "Column|Name"
column comments format a50 heading "Comment on this table/view"
select t.OWNER
, t.TABLE_NAME
, t.COLUMN_NAME
, c.comments
from dba_tab_columns t
, dba_col_comments c
where DATA_TYPE like upper ('&&COL_TYPE.')
and t.OWNER = c.OWNER(+)
and t.TABLE_NAME = c.TABLE_NAME(+)
and t.COLUMN_NAME = c.COLUMN_NAME(+)
and t.owner = upper ('&&OWNER.')
order by OWNER, TABLE_NAME, COLUMN_NAME
/