Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Insert Records into a table

Re: Insert Records into a table

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 7 Sep 2006 10:04:40 -0700
Message-ID: <1157648680.372714.103310@p79g2000cwp.googlegroups.com>

B. Williams wrote:
> I have created a table with two columns and one of the columns is the month
> and the other is the date. I want to use a pl/sql program to insert the
> months and dates into the table using a loop instead of using a bunch of
> insert statements.Will someone assist me with this? If I can get some help
> with January, I can figure the rest of the months out.
>
> Thanks

You do not need pl/sql or a bunch of SQL statements.

Take a look at the following query and see if you cannot figure out a way to convert it into an update statement.

  1 select to_char(to_date('01-JAN-06') + a.increase,'MONTH')   2 ,to_char(to_date('01-JAN-06') + a.increase,'DD')   3 from (select rownum as increase from all_objects   4* where rownum < 366) A

DECEMBER 28
DECEMBER 29
DECEMBER 30
DECEMBER 31
JANUARY 01 365 Rows selected

See the SQL manual for the complete list of format options for the to_char and to_date functions plus look up add_months, last_day, and trunc.

HTH -- Mark D Powell -- Received on Thu Sep 07 2006 - 12:04:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US