▶ DB에 있는 모든 Table 이름보기
select table_name from user_tables
▶ Table의 Primary Key 찾기
select * from user_ind_columns where table_name = 'CodeTable'
▶ 인수전달
select * from user_ind_columns where table_name = '&1'
→; save key
SQL> start key CodeTable
▶ 서로 연결되는 Key를 찾는 방법
select constraint_name, constraint_type, r_constraint_name
from user_constraints
where table_name = 'TABLE_NAME
▶ TABLE 구조 보기
DESC TABLE_NAME
▶ Constraint 확인
select table_name, constraint_name, constraint_type
from user_constraints
where table_name in ('DEPARTMENT','EMPLOYEE');
▶ 테이블 COPY 하기
create table emp_41
as
select id, last_name, userid, start_date from s_emp
where dept_id = 41;
→ where절에 엉뚱한 조건을 주면 emp_41이란 이름으로 테이블이 만들어진다.
▶ 선택한 Row만큼만 보여주기
select * from tmp_table
where rownum <= 100
→ 이렇게 하면 데이터가 10000건이 있더라도, 1~100건만 보여주게 된다.
▶ 오라클의 모든 유저 보기
select * from all_users
KO16KSC5601 이면 한글...
US7ASCII 이면 영문이다. → regedit에서 편집하면 간단히 해결.
▶ Space 있는 값을 Null로 비교
RTRIM(a.ymd_myun) IS NULL
▶ Desc명령으로 Table구조 보는 효과와 같은 방법
SELECT column_name, data_type, data_length, nullable FROM cols
WHERE table_name = 'YTB_CARCOM'
→ 반드시 테이블명은 대문자 이어야 한다.
▶ Function Script 보는 방법.
select text from user_source where name = 'FUNCTION_NAME'
▶ 요일 찾는 방법.
select TO_CHAR(sysdate,'D') from dual
출처 : [기타] 인터넷 : www.hacker-academy.co.kr
'DataBase > Oracle' 카테고리의 다른 글
Oracle9i AS의 주요 모듈 : OC4J (0) | 2008.10.08 |
---|---|
Oracle ERP에서 사용하는 DB관련 작업 (0) | 2008.09.18 |
오라클 관계형 데이터베이스의 소개 (0) | 2008.09.17 |
[Scrap] Oracle Data Pump (Oracle 10g) (0) | 2008.08.29 |
Oracle Online Study Site (0) | 2008.08.19 |
[펌] Oracle ADF 배우기 (1) | 2008.08.14 |
Oracle Forms 설치. (0) | 2008.08.11 |
Oracle Application Development Framework(ADF) 개요 (0) | 2008.07.14 |
[scrap] HINT 사용하기 ( /* */ ) (출처:sqler.pe.kr) (0) | 2008.04.28 |
[scrap] 데이터 베이스 문자 안깨지도록 windows에서 nls-lang 변경하기 (0) | 2008.04.28 |