[tip]

▶ 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


   ▶코멘트(comment)보기
   select * from all_col_comments where table_name= '테이블명'

※ Oracle SID 확인
SQL> select instance from v$thread;
 

※ Oracle DB_NAME 확인
SQL> select name from v$database;
 

※ Oracle User 확인
SQL> select * from all_users;
 

※ 등록된 User 목록 보기
SQL> select username, user_id from dba_users order by username;
 

※ User가 소유한 모든 테이블 보기
SQL> select table_name from user_tables;
 

※ 사용자 정보 확인
SQL> select username, default_tablespace,temporary_tablespace from dba_users;
 

※ 오브젝트 조회
SQL> select * from all_objects where object_name like '명';
 

※ 테이블 조회
SQL> select * from all_tables where table_name like '명';
 

※ 시퀀스 정보 보기
SQL> select * from user_sequences;
 

※ 시노님 조회
SQL> select * from all_synonyms where synonym_name='명';
 

※ 테이블 인덱스 정보 조회
SQL> select * from all_ind_columns where table_name='테이블명';
 

※ 테이블의 컬럼 정보 조회
SQL> select * from all_tab_columns where table_name='테이블명';
 

※ table comment 쿼리
SQL> select * from all_tab_comments where table_name='테이블명';
 

※ column comment 쿼리
SQL> select * from all_col_comments where table_name='테이블명';

by 단다니 | 2007/05/03 17:41 | oracle | 트랙백 | 덧글(0)

트랙백 주소 : http://dani.egloos.com/tb/1560057
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

◀ 이전 페이지          다음 페이지 ▶