-- ------------------------------------------------------------------------------------------------
-- [ 공통관리] 사용자데이터 테이블 생성
conn system/built123$@ndb;
-- ------------------------------------------------------------------------------------------------
-- 테이블 생성
drop table bcom.com_user_data cascade constraints;
create table bcom.com_user_data
(
corp_id number not null
,auth_data_id number not null
,user_id number not null
,data_type_cd varchar2(50) not null
,data_value varchar2(200) not null
,include_yn varchar2(1) default 'Y' not null
,exclude_yn varchar2(1) default 'N' not null
,sub_include_yn varchar2(1) default 'N' not null
,sub_exclude_yn varchar2(1) default 'N' not null
,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 bcom.com_user_data is '[공통관리] 사용자데이터';
comment on column bcom.com_auth_menu.corp_id is '법인ID';
comment on column bcom.com_user_data.auth_data_id is '사용자데이터ID';
comment on column bcom.com_user_data.user_id is '사용자ID';
comment on column bcom.com_user_data.data_type_cd is '데이터구분코드';
comment on column bcom.com_user_data.data_value is '데이터값';
comment on column bcom.com_user_data.include_yn is '포함여부';
comment on column bcom.com_user_data.exclude_yn is '제외여부';
comment on column bcom.com_user_data.sub_include_yn is '예하포함여부';
comment on column bcom.com_user_data.sub_exclude_yn is '예하제외여부';
comment on column bcom.com_user_data.create_date is '생성일시';
comment on column bcom.com_user_data.create_by is '생성자';
comment on column bcom.com_user_data.update_date is '수정일시';
comment on column bcom.com_user_data.update_by is '수정자';
-- primary 인덱스
alter table bcom.com_user_data add constraint com_user_data_pk primary key (auth_data_id) using index tablespace bdb_idx;
-- unique 인덱스
create unique index bcom.com_user_data_uk01 on bcom.com_user_data (corp_id, user_id, data_type_cd, data_value) tablespace bdb_idx;
-- 권한부여
grant select, insert, update, delete on bcom.com_user_data to bsys with grant option;
grant select, insert, update, delete on bcom.com_user_data to bhrm with grant option;
-- 트리거
create or replace trigger bcom.com_user_data_trg
before insert or update on bcom.com_user_data
for each row
begin
if :new.auth_data_id is null then
:new.auth_data_id := com_user_data_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 com_user_data for bcom.com_user_data;
conn bhrm/1234@ndb;
create or replace synonym com_user_data for bcom.com_user_data;
'오라클 > 테이블(공통관리)' 카테고리의 다른 글
[ 사용자데이터 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |
---|---|
[ 권한메뉴 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |
[ 메뉴 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |
[ 사용자권한 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |
[ 권한 ] 테이블 생성을 아래와 같이 진행합니다. (0) | 2024.04.12 |