Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Inserting Records Into a table
B. Williams wrote:
> "B. Williams" <willdrama_at_hotmail.com> wrote in message
> news:yV0Mg.10111$JR5.8533_at_dukeread11...
> >
> > "Ed Prochak" <edprochak_at_gmail.com> wrote in message
> > news:1157660418.704290.80130_at_h48g2000cwc.googlegroups.com...
> >>
[]
> > I can get the loop to isert the months into the table using the following
> > code.
> >
> > FOR i IN 1..12 LOOP
> > INSERT INTO yeardates
> > (year_month)
> > VALUES(varray_name(i));
> > END LOOP;
> >
> > I can also get the loop to insert the date using a similiar loop
> >
> > FOR j IN 1..31 LOOP
> > INSERT INTO yeardates
> > (year_day)
> > VALUES(varray_date(j));
> > My problem is that I can't figure out how to get my output to display the
> > (month day) format and even more confusing is that I can't figure out
> > how to have January display 31 dates while having February displays only
> > 28 and so on.
> >
> > I need to make a loop for each month that will display that month along
> > with the days of that month.
> >
> > Can you assist me with that.
> >
> >
> >
> > This is the code I have so far.
>
>
>
>
>
>> varray_name(11) := 'November';
> varray_name(1) := 'January';
> varray_name(2) := 'February';
> varray_name(3) := 'March';
> varray_name(4) := 'April';
> varray_name(5) := 'May';
> varray_name(6) := 'June';
> varray_name(7) := 'July';
> varray_name(8) := 'August';
> varray_name(9) := 'September';
> varray_name(10) := 'October';
>> v_counter := v_counter + 1;
> dbms_output.put_line( 'YEAR_MONTH' || ' ' ||'YEAY_DAY');
>
> FOR i IN 1..12 LOOP
> INSERT INTO yeardates
> (year_month)
> VALUES(varray_name(i));
> >
> FOR j IN 1..31 LOOP
> INSERT INTO yeardates
> (year_day)
> VALUES(varray_date(j));
> dbms_output.put_line( varray_name(i) || ' ' ||varray_date(j));
>
> >
Hey you got it!!!!
Just ignore my other post, I obviously did not see this reply before I wrote it. Now you just need some code to handle the different month lengths (30days hath September...)
Good job.
Ed
as he slinks back into a corner,
vowing never to reply until reading all messages in a thread! 8^)
Received on Fri Sep 08 2006 - 13:11:32 CDT
![]() |
![]() |