If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I need a program that will insert all the MONTHS.(ie JANUARY..), and all the DAYS of each month,(ie 1,2,3...) for a total of 1 full year. It must also include a Counter that will be used to display a message stating the total records inserted,(ie "365 records inserted").

Argh, I didn't notice you want to do inserts in a PL/SQL loop (although I don't see why you should, when a simple SQL will do). Anyway, you can convert the above select into a cursor and perform inserts in a loop.

Jurij ModicASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?

Being a new student, I would like to understand better
exactly how this method works.

I also wonder how this same procedure would be done using the format that I am more familiar with, (ie DECLARE, CURSOR, BEGIN, .....).

The program that is actually requested of me is expected to be written using a separate loop for each month, which I can currently do for 1 month, but it's when I try to include all 12 loops in one nicely constructed program where I get hung up.

Granted this would be a much more time-consuming manner in which to accomplish what you have so concisely presented to me, I think for the sake of learning it would be really cool to do it the "hard way" as well.

Anyway, I really appreciate all your help. I'm gonna go try to figure out how to do using 12 separate loops within one program now.

If you get a chance, post how it could be done that way, but dont go out of your way as I feel you have already gone beyond the call for me.

Actually it wouldn't be wise to use any cursor (DECLARE, OPEN, LOOP, FETCH, CLOSE) for this task, but sure, it can be done that way too.

If you wan't to do it with the separate loop for each month, then I would suggest the following. Use one FOR loop with 12 iterations, one for each month. This will be an outer loop and in each iteration it will start a separate inner FOR loop that will do as many itterations as there is days in that month.

As number of months in each year is fixed, you can safely hard code that fact in the outer loop. However the inner loop will have different number of iterations each time, depending on which month (and because of leap years also depending on the year) it is processing. So it wouldn't be wise to hard code that in the program, you'd better use some builtin date functions to determine the number of days in each particular month. LAST_DATE() function would be a good candidate to use for this.