-- ------------------------------------------------------------------------------------------------
-- [ 인사관리 ] 발령 테이블 생성
conn system/built123$@ndb;
-- ------------------------------------------------------------------------------------------------
-- 테이블 생성
drop table bhrm.hrm_assignment cascade constraints;
create table bhrm.hrm_assignment
(
corp_id number not null
,asg_id number not null
,asg_subject varchar2(200) not null
,emp_id number not null
,asg_num varchar2(0020) not null
,asg_date date default trunc(sysdate) not null
,biz_id number not null
,asg_cd varchar2(0050) not null
,asg_detail_cd varchar2(0050) not null
,primary_yn varchar2(0001) default 'Y' not null
,dept_id number not null
,grade_cd varchar2(0050)
,grade_title_cd varchar2(0050)
,job_group_cd varchar2(0050)
,job_cd varchar2(0050)
,position_cd varchar2(0050)
,probation_rate_cd varchar2(0050)
,probation_end_date date
,absence_end_date date
,dis_start_date date
,dis_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_assignment is '[인사관리] 발령';
comment on column bhrm.hrm_assignment.corp_id is '법인ID';
comment on column bhrm.hrm_assignment.asg_id is '발령ID';
comment on column bhrm.hrm_assignment.asg_subject is '인사명령';
comment on column bhrm.hrm_assignment.emp_id is '임직원ID';
comment on column bhrm.hrm_assignment.asg_num is '발령번호';
comment on column bhrm.hrm_assignment.asg_date is '발령일자';
comment on column bhrm.hrm_assignment.biz_id is '사업장ID';
comment on column bhrm.hrm_assignment.asg_cd is '발령코드';
comment on column bhrm.hrm_assignment.asg_detail_cd is '발령상세코드';
comment on column bhrm.hrm_assignment.primary_yn is '주발령여부';
comment on column bhrm.hrm_assignment.dept_id is '부서ID';
comment on column bhrm.hrm_assignment.grade_cd is '직급코드';
comment on column bhrm.hrm_assignment.grade_title_cd is '직위코드';
comment on column bhrm.hrm_assignment.job_group_cd is '직군코드';
comment on column bhrm.hrm_assignment.job_cd is '직무코드';
comment on column bhrm.hrm_assignment.position_cd is '직책코드';
comment on column bhrm.hrm_assignment.probation_rate_cd is '수습비율코드';
comment on column bhrm.hrm_assignment.probation_end_date is '수습해지일자';
comment on column bhrm.hrm_assignment.absence_end_date is '휴직종료일자';
comment on column bhrm.hrm_assignment.dis_start_date is '감봉시작일자';
comment on column bhrm.hrm_assignment.dis_end_date is '감봉종료일자';
comment on column bhrhttp://m.hrm_assignment.remark is '비고';
comment on column bhrm.hrm_assignment.create_date is '생성일시';
comment on column bhrm.hrm_assignment.create_by is '생성자';
comment on column bhrm.hrm_assignment.update_date is '수정일시';
comment on column bhrm.hrm_assignment.update_by is '수정자';
-- primary 인덱스
alter table bhrm.hrm_assignment add constraint hrm_assignment_pk primary key (asg_id) using index tablespace bdb_idx;
-- unique 인덱스
create unique index bhrm.hrm_assignment_uk01 on bhrm.hrm_assignment (corp_id, asg_num) tablespace bdb_idx;
create unique index bhrm.hrm_assignment_uk02 on bhrm.hrm_assignment (corp_id, emp_id, asg_date, asg_cd, asg_detail_cd) tablespace bdb_idx;
-- normal 인덱스
create index bhrm.hrm_assignment_ix01 on bhrm.hrm_assignment (asg_subject) tablespace bdb_idx;
create index bhrm.hrm_assignment_ix02 on bhrm.hrm_assignment (corp_id, asg_date, asg_num) tablespace bdb_idx;
-- 권한부여
grant select, insert, update, delete on bhrm.hrm_assignment to bsys with grant option;
grant select, insert, update, delete on bhrm.hrm_assignment to bcom with grant option;
-- 트리거 생성
create or replace trigger bhrm.hrm_assignment_trg
before insert or update on bhrm.hrm_assignment
for each row
begin
if :new.asg_id is null then
:new.asg_id := hrm_assignment_s.nextval;
end if;
if inserting then
:new.create_date := systimestamp;
:new.create_by := nvl(wwv_flow.g_user, user);
end if;
:new.update_date := systimestamp;
:new.update_by := nvl(wwv_flow.g_user, user);
end;
/
-- 시노님 생성
conn bsys/1234@ndb;
create or replace synonym hrm_assignment for bhrm.hrm_assignment;
conn bcom/1234@ndb;
create or replace synonym hrm_assignment for bhrm.hrm_assignment;
'오라클 > 테이블(인사관리)' 카테고리의 다른 글
[ 임직원기본 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |
---|---|
[ 임직원 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |
[ 조직도상세 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |
[ 조직도 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |
[ 사업장 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |