Data per day in oracle statistical period (recommended), oracle per day
The following describes the data of each day in the oracle statistical period. The specific SQL statement is as follows:
1. generate 1000 RANDOM numbers select rownum rn, DBMS_RANDOM.VALUE (0, 1000) random from dual connect by rownum <= 1000; Note: DBMS_RANDOM.VALUE (A, B) is A RANDOM number generation function, A is the start of the interval, and B is the end of the interval. 2. for example, to split A, B, C, and D strings separated by commas (,), SELECT REGEXP_SUBSTR ('a, B, C, D', '[^,] +', 1, ROWNUM) from dual connect by rownum <= REGEXP_COUNT ('a, B, C, D', '[,]', 1) + 1; Note: REGEXP_SUBSTR is A string truncation regular expression: a, B, C, and D are the string to be intercepted. [^,] + is the regular expression matching mode. Matching starts with any character other than commas, A segment of characters ending with any character other than a comma. Starting from a character, ROWNUM is the matched ROWNUM string. REGEXP_COUNT is the regular expression of the number query: A, B, C, D is the string to be truncated; [,] is the regular expression matching mode, matching with commas, 1 is from the first character; REGEXP_COUNT + 1 can calculate how many substrings 3. list all the months between two months SELECT TO_CHAR (ADD_MONTHS (DATE '2017-03-01 ', ROWNUM-1), 'yyyy-mm ') months from dual connect by rownum <= MONTHS_BETWEEN (DATE '2017-03-01 ', DATE '2017-03-01') + 1; 4. list all days between two dates SELECT TO_CHAR (DATE '2017-05-11 '+ ROWNUM-1, 'yyyy-MM-DD ') as days from dual connect by rownum <= DATE '2017-01-02 '-date' 2018-03-07' + 1
PS: Let's take a look at the date of each day for a certain period of time in Oracle.
SELECT TO_DATE('2016-01-01', 'yyyy-MM-dd') + ROWNUM - 1 as daylist,TO_DATE('2016-01-01', 'yyyy-MM-dd') + ROWNUM as daylistsFROM DUALCONNECT BY ROWNUM <=trunc(to_date('2016-07-31', 'yyyy-MM-dd') -to_date('2016-01-01', 'yyyy-MM-dd')) + 1
Summary
The above section describes the data of each day in the oracle statistical period. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!