DB/Oracle
Procedure(프로시저) 랜덤값으로 반복문 주기
inderrom
2023. 3. 3. 15:54
- 랜덤값 주기 (y/n)
select *
from
(
select *
from
(select 'y' from dual union all
select 'n' from dual
)
order by DBMS_RANDOM.random)
where rownum = 1;
- 반복문으로 더미 데이터 넣기
DECLARE
I NUMBER := 32;
BEGIN
WHILE I <= 60 LOOP
INSERT INTO RESUME (RSM_NO, MEM_ID, RSM_TITLE,RSM_TMPR_STRG_YN,RSM_RPRS)
VALUES ('RNO0'||I, 'ddit@ddit.or.kr' || (I-31),('이력서'|| (I-31)),'N','');
I := I + 1;
END LOOP;
END;
- 이력서 더미 데이터
-- 이력서 더미 데이터
DECLARE
I NUMBER := 1;
BEGIN
WHILE I <= 60 LOOP
INSERT INTO RESUME (RSM_NO, MEM_ID, RSM_TITLE,RSM_TMPR_STRG_YN,RSM_RPRS)
VALUES ('RSM'||I, 'ddit@ddit.or.kr' || I,('이력서'|| I),'N','');
I := I + 1;
END LOOP;
END;
- 학력 더미 데이터
DECLARE
I NUMBER := 1;
BEGIN
WHILE I <= 60 LOOP
INSERT INTO ACADEMIC_BACKGROUND (ACBG_NO, RSM_NO, ACBG_UNIVERSITY_NM,ACBG_MAJOR,ACBG_DEGREE,
ACBG_MTCLTN_DT,ACBG_GRDTN_DT,ACBG_ATTND_YN)
VALUES ('ACBG'|| I, 'RSM'||I,'서울대학교'|| I,'컴퓨터공학과'|| I,
(select *
from
(
select *
from
(select '학사' from dual union all
select '석사' from dual union all
select '박사' from dual
)
order by DBMS_RANDOM.random)
where rownum = 1),'2016-03-02','2020-02-14',
(select *
from
(
select *
from
(select 'Y' from dual union all
select 'N' from dual
)
order by DBMS_RANDOM.random)
where rownum = 1)
);
I := I + 1;
END LOOP;
END;
- 경력 더미 데이터
DECLARE
I NUMBER := 1;
BEGIN
WHILE I <= 60 LOOP
INSERT INTO CAREER (CRR_NO, RSM_NO, CRR_ENT_NM,CRR_JBGD_NM,
CRR_JNCMP_DT,CRR_RTRM_DT,CRR_HDOF_YN)
VALUES ('CRR'||I, 'RSM'||I,'대덕기업'|| I,
(select *
from
(
select *
from
(select '사원' from dual union all
select '과장' from dual union all
select '부장' from dual
)
order by DBMS_RANDOM.random)
where rownum = 1),'2020-06-04','2022-09-01',
(select *
from
(
select *
from
(select 'Y' from dual union all
select 'N' from dual
)
order by DBMS_RANDOM.random)
where rownum = 1)
);
I := I + 1;
END LOOP;
END;