Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: generate list of days of curr month in SQLPLUS
On Tue, 01 Sep 1998 16:08:42 -0700, Kal Khatib <kkhatib_at_cisco.com>
wrote:
>is it possible to write a statement that returns
>number_of_days_in_curr_month rows, each row containing the day,
>in SQLPLUS?
>
>example:
>
>day
>-----
>1
>2
>3
>...
>...
>31
try:
SQL> select rownum day
2 from all_objects
3 where rownum <= to_char( last_day( sysdate ), 'DD' )
4 /
DAY
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
30 rows selected.
You can select this from any table with at least 31 rows in it.
chris.
>
>thanks
>Kal.
Received on Wed Sep 02 1998 - 09:03:32 CDT
![]() |
![]() |