In the query module of the latest project, the query condition uses the year, month, and day drop-down boxes. By default, data must be filled in the drop-down boxes, which are year, month, and day, and cascade requirements must be met. In this case, you need to fill in the month data based on different years and fill in different days for different months. The filled data needs to be queried using the statement. The desired result is finally achieved through hard work, as shown below:
1. Year:
Select (1-level + to_char (sysdate, 'yyyy') years from dualconnect by level <= 10
2. month:
Select case when Mons <10 then '0' | Mons else to_char (Mons) end monsnew from (select (1-level + decode (to_char (sysdate, 'yyyy '), '? Year ', -- parameter, this year only fills in the time to_char (sysdate, 'mm'), 12) Mons from dualconnect by level <= decode (to_char (sysdate, 'yyyy '),'? Year ', to_char (sysdate, 'mm'), 12 ))
3. Date:
Select case when days <10 then '0' | days else to_char (days) end daysnew from (select (1-level + decode (to_char (sysdate, 'yyyy '), '? Year ', decode (to_char (sysdate, 'mm '),'? Month ', to_number (to_char (sysdate, 'dd'), to_number (to_char (last_day (to_date ('? Year? Month '', 'yyyymmm '), 'dd'), to_number (to_char (last_day (to_date ('? Year? Month '', 'yyyymmm '), 'dd') days from dualconnect by level <= decode (to_char (sysdate, 'yyyy '),'? Year ', decode (to_char (sysdate, 'mm'), '08', to_number (to_char (sysdate, 'dd'), to_number (to_char (last_day (to_date ('? Year? Month ', 'yyyymmm'), 'dd'), to_number (to_char (last_day (to_date ('? Year? Month '', 'yyyymmm '), 'dd '))))
I think this statement is very useful. If you have other good statements, I hope you can share them ~~~