본문 바로가기
  • 노란색 세상은 어디에 있을까?
  • 봄이 오면 여기에 있겠지.
  • 잠시나마 유유자적 하겠네.
오라클/테이블(인사관리)

[ 조직도 ] 테이블 생성을 아래와 같이 진행합니다.

by 태백성 2024. 4. 12.

-- ------------------------------------------------------------------------------------------------
-- [ 인사관리 ] 조직도 테이블 생성
conn system/built123$@ndb;
-- ------------------------------------------------------------------------------------------------
-- 테이블 생성
drop   table bhrm.hrm_dept_hierarchy cascade constraints;
create table bhrm.hrm_dept_hierarchy
(
     corp_id                   number         not null
    ,dept_hierarchy_id         number         not null
    ,dept_hierarchy_cd         varchar2(50)   not null
    ,dept_hierarchy_name       varchar2(200)  not null
    ,dept_hierarchy_short_name varchar2(100)
    ,start_date                date           default trunc(sysdate) not null
    ,end_date                  date
    ,remark                    varchar2(4000)
    ,create_date               timestamp      default systimestamp
    ,create_by                 varchar2(50)   default '-1'
    ,update_date               timestamp      default systimestamp
    ,update_by                 varchar2(50)   default '-1'
) tablespace bdb_data;

-- 테이블 설명
comment on table  bhrm.hrm_dept_hierarchy                             is '[인사관리] 조직도';
comment on column bhrm.hrm_dept_hierarchy.corp_id                     is '법인ID';
comment on column bhrm.hrm_dept_hierarchy.dept_hierarchy_id           is '조직도ID';
comment on column bhrm.hrm_dept_hierarchy.dept_hierarchy_cd           is '조직도코드';
comment on column bhrm.hrm_dept_hierarchy.dept_hierarchy_name         is '조직도명';
comment on column bhrm.hrm_dept_hierarchy.dept_hierarchy_short_name   is '조직도명(약칭)';
comment on column bhrm.hrm_dept_hierarchy.start_date                  is '시작일자';
comment on column bhrm.hrm_dept_hierarchy.end_date                    is '종료일자';
comment on column bhrhttp://m.hrm_dept_hierarchy.remark is '비고';

comment on column bhrm.hrm_dept_hierarchy.create_date                 is '생성일시';
comment on column bhrm.hrm_dept_hierarchy.create_by                   is '생성자';
comment on column bhrm.hrm_dept_hierarchy.update_date                 is '수정일시';
comment on column bhrm.hrm_dept_hierarchy.update_by                   is '수정자';

-- primary 인덱스
alter table bhrm.hrm_dept_hierarchy add constraint hrm_dept_hierarchy_pk primary key (dept_hierarchy_id) using index tablespace bdb_idx;

-- unique 인덱스
create unique index bhrm.hrm_dept_hierarchy_uk01 on bhrm.hrm_dept_hierarchy (corp_id, dept_hierarchy_cd) tablespace bdb_idx;

-- normal 인덱스
create index bhrm.hrm_dept_hierarchy_ix01 on bhrm.hrm_dept_hierarchy (dept_hierarchy_name) tablespace bdb_idx;

-- 권한부여
grant select, insert, update, delete on bhrm.hrm_dept_hierarchy to bsys with grant option;
grant select, insert, update, delete on bhrm.hrm_dept_hierarchy to bcom with grant option;

-- 시노님 생성
conn bsys/1234@ndb;
create or replace synonym hrm_dept_hierarchy for bhrm.hrm_dept_hierarchy;

conn bcom/1234@ndb;
create or replace synonym hrm_dept_hierarchy for bhrm.hrm_dept_hierarchy;