Database/oracle
[oralce] 프로젝트 운영시 쓰는 SQL 기본운영사항
평범한kiki
2023. 4. 17. 15:49
**SQL 기본운영사항***
--테이블명 조회
select A.table_name, B.comments
from all_tables A, all_tab_comments B
where A.table_name = '테이블명'
and A.table_name = B.table_name
order by A.table_name
;
select *
from all_tab_comments
where 1=1
and table_type = 'TABLE'
and comments like '%사원%'
order by owner, table_name
;
--컬럼명 테이블 찾기
select
from all_tab_columns atc, all_tab_comments atcm
where atc.column_name = '컬럼명'
and atc.owner = atcm.owner
and atc.table_name = atcm.table_name
--and atcm.table_type = 'TABLE'
order by atc.owner, atc.table_name
;
--프로시져 text 검색
select *
from user_source
where 1=1
and type = 'PROCEDURE'
and text LIKE '%찾을text%'
order by name, line
;
select *
from all_source
where 1=1
and type = 'PROCEDURE'
and text LIKE '%찾을text%'
;