테스트용 대용량 랜덤 데이터 만들기
개발 관련/Query 2022. 2. 9. 20:20 |create table TEST_LC_DATA as
select
IDX,
TEST_STRING,
RANDOM_STRING,
RANDOM_DATE as NIND_DATE,
RANDOM_DATE as IND_DATE,
TO_CHAR(RANDOM_DATE, 'YYYYMMDDHH24MISS') as NIND_DTOS,
TO_CHAR(RANDOM_DATE, 'YYYYMMDDHH24MISS') as IND_DTOS,
RANDOM_STR as NIND_CONTENT,
RANDOM_STR as IND_CONTENT
from
(
select
GS as IDX,
'테스트 문자열 ' || SUBSTR(MD5(RANDOM()::text),0,5) as TEST_STRING,
MD5(RANDOM()::text) as RANDOM_STRING,
TIMESTAMP '2010-01-10 00:00:00' + RANDOM()
* (TIMESTAMP '2021-12-31 23:59:59' - TIMESTAMP '2010-01-01 00:00:00') as RANDOM_DATE,
SUBSTRING('가나다라마바사아자차카파하', TRUNC(RANDOM() * 13)::INTEGER + 1, TRUNC(RANDOM() * 3)::INTEGER + 2) as RANDOM_STR
from
GENERATE_SERIES(1, 10000000) as GS ) as TEST_LC_DATA;
generate_series 부분에 만들양을 설정