Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Nat, "1 to 31" are not "dates"...they are just numbers. "01-OCT-2006" through "31-OCT-2006" are dates. I cannot tell which you need: 31 numbers or 31 dates. You do not need a "temp table"; an in-line view should do what you want. And since you haven't told us anything about your "stored prog", I'll illustrate proof of concept with bind variables, which should work just as well as arguments, but we don't need a "prog" for the proof of concept:Nat said:...the temp table will fill with dates from 1 to 31...
SQL> var p_month char(2)
SQL> exec :p_month := '02'
SQL> var p_year number
SQL> exec :p_year := 2000;
select day
from (select rownum day from all_objects
where rownum <= to_char(last_day(to_date(:p_month||:p_year,'mmyyyy')),'dd'))
/
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
**************************************************************************************
SQL> var p_month char(2)
SQL> exec :p_month := '02'
SQL> var p_year number
SQL> exec :p_year := 2001;
select dates
from (select to_date(:p_month||substr('0'||rownum,-2)||:p_year,'mmddyyyy')dates
from all_objects
where rownum <= to_char(last_day(to_date(:p_month||:p_year,'mmyyyy')),'dd'))
/
DATES
---------
01-FEB-01
02-FEB-01
03-FEB-01
04-FEB-01
05-FEB-01
06-FEB-01
07-FEB-01
08-FEB-01
09-FEB-01
10-FEB-01
11-FEB-01
12-FEB-01
13-FEB-01
14-FEB-01
15-FEB-01
16-FEB-01
17-FEB-01
18-FEB-01
19-FEB-01
20-FEB-01
21-FEB-01
22-FEB-01
23-FEB-01
24-FEB-01
25-FEB-01
26-FEB-01
27-FEB-01
28-FEB-01