database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
ㆍOracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Oracle Tutorials 9331 게시물 읽기
 News | Q&A | Columns | Tutorials | Devel | Files | Links
No. 9331
오라클 tip 몇가지
작성자
정재익(advance)
작성일
2002-01-07 02:35
조회수
8,314

◆ 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

 

 

◆ Parameter정보 보기 (한/영코드값, 버젼정보등을 볼수있다.)

 

select * from nls_database_parameters

 

---> 이때, NLS_CHARACTERSET의 Value가 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

[Top]
No.
제목
작성자
작성일
조회
9334오라클 9i 에서 추가된 timestamp 자료형
정재익
2002-01-07
9116
9333client-server환경에서 비정상 종료된 session정리 방법
정재익
2002-01-07
5542
9332View 테이블 만들기
정재익
2002-01-07
9891
9331오라클 tip 몇가지
정재익
2002-01-07
8314
9330오라클 설치후 각각의 디렉토리에 대한 설명
정재익
2002-01-07
5529
9329DYNAMIC SQL 이란?
정재익
2002-01-07
7864
9328Rollback Segment 의 크기와 갯수
정재익
2002-01-07
5272
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.019초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다