SELECT '20131001' DT, ROUND(DBMS_RANDOM.VALUE(0, 100000)) AMT FROM DUAL UNION ALL
SELECT '20131002', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131003', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131004', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131005', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131006', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131007', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131008', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131009', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131010', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131011', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131012', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131013', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131014', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131015', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131016', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131017', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131018', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131019', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131020', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131021', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131022', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131112', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131113', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131114', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131115', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131116', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131117', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131118', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131119', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131120', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131121', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131122', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131123', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131124', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL UNION ALL
SELECT '20131125', ROUND(DBMS_RANDOM.VALUE(0, 100000)) FROM DUAL
위와같은 데이터가 있다고 가정할 때
연속된 DT의 시작과 끝을 각각 구하고 싶은데 도무지 답이 안나오네요.....
위 데이터를 예를 들면
시작일 || 종료일
20131001 20131022
20131112 20131125
이런 형태로 데이터를 뽑고 싶습니다....
고수님들의 도움 부탁드려요~
아.... DBMS_RANDOM으로 AMT값 뽑은건 테스트 하려고 만든거라... 무시하셔도 됩니다..
|