The current date is 2018/08/12.
1. Get the number of days in the current month:
Select To_number (To_char (Last_day (sysdate), ' DD ')) from dual
2. Get the full date 30 days before the current date.
Select trunc (sysdate-+)+ as from by RowNum<= ;
The results of the implementation are as follows:
2. Get the full date for the one months preceding the current date. The one months here will be given the number of days of the month based on the current month, which may be 31, 30, or 29 days.
Select trunc (sysdate-to_number (To_char (Last_day (sysdate),'dd')) + as from by rownum<=to_number (To_char (Last_day (sysdate),'dd'))
The results of the implementation are as follows:
4. Get the current day of the week (including the current date).
Select trunc (sysdate-7)+ as from by RowNum<= 7
5. Get the current day of the week (not including the current date).
Select trunc (sysdate-8)+ as from RowNum<=7
Or
Select trunc (sysdate-7)+rownum-1 as from by rownum<=7
The results of the implementation are as follows:
6. Get 10 consecutive digits starting from 10
Select Ten + as from by rownum<=;
Oracle gets the full date one months before the current date