Obsidian/Recognition/Programing/Tibero/Tibero 스크립트 추출.md

34 lines
854 B
Markdown

``` sql
-- table ddl
select to_char(dbms_metadata.get_ddl('TABLE','SACP_AC','UCM')) from dual
-- index ddl
select to_char(dbms_metadata.get_ddl('INDEX',index_name,'UCM'))
from DBA_indexes
where table_name = 'SACP_AC'
-- table comment
select 'COMMENT on TABLE '||owner||'.'||table_name||' IS '''||comments||''';' as comments
from dba_tab_comments
where owner='UCM'
and table_name = 'SACP_AC'
and comments is not null
union all
-- column comment
select 'COMMENT on COLUMN '||owner||'.'||table_name||'.'||column_name||' IS '''||comments||''';' as comments
from dba_col_comments
where owner='UCM'
and table_name = 'SACP_AC'
and comments is not null;
-- 오브젝트 소스
SELECT *
FROM DBA_SOURCE
WHERE owner = 'UCM'
AND name = 'SACP_AC'
--AND type = :type; -- 오브젝트 타입 (PROCEDURE, FUNCTION, PACKAGE, PACKAGE BODY, TRIGGER ...)
```