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

[ 임직원기본 ] 테이블 생성을 아래와 같이 진행합니다.

by 태백성 2024. 4. 12.

-- ------------------------------------------------------------------------------------------------
-- [ 인사관리 ] 임직원기본 테이블 생성
conn system/built123$@ndb;
-- ------------------------------------------------------------------------------------------------
-- 테이블 생성
drop   table bhrm.hrm_employee_basic cascade constraints;
create table bhrm.hrm_employee_basic
(
     emp_id                       number         not null
    ,group_hire_date              date           not null
    ,annual_date                  date           not null
    ,retirement_date              date           not null
    ,retirement_pension_date      date
    ,mid_adjustment_date          date
    ,marital_status_cd            varchar2(50)   default 'U' not null
    ,wedding_date                 date
    ,work_place_cd                varchar2(50)
    ,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_employee_basic                            is '[인사관리] 임직원기본';
comment on column bhrm.hrm_employee_basic.emp_id                     is '임직원ID';
comment on column bhrm.hrm_employee_basic.group_hire_date            is '그룹입사일자';
comment on column bhrm.hrm_employee_basic.annual_date                is '연차기산일자';
comment on column bhrm.hrm_employee_basic.retirement_date            is '퇴직금기산일자';
comment on column bhrm.hrm_employee_basic.retirement_pension_date    is '퇴직연금일자';
comment on column bhrm.hrm_employee_basic.mid_adjustment_date        is '중도정산일자';
comment on column bhrm.hrm_employee_basic.marital_status_cd          is '결혼코드';
comment on column bhrm.hrm_employee_basic.wedding_date               is '결혼기념일자';
comment on column bhrm.hrm_employee_basic.work_place_cd              is '근무지코드';

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

-- primary 인덱스
alter table bhrm.hrm_employee_basic add constraint hrm_employee_basic_pk primary key (emp_id) using index tablespace bdb_idx;

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

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

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