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: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 07 Sep 2006 22:40:18 +0200
Message-ID: <hs01g21b8f36ue3qphvnthimnpe0rkqp3n@4ax.com>


On Thu, 7 Sep 2006 13:40:19 -0400, "B. Williams" <willdrama_at_hotmail.com> wrote:

>
>"Mark D Powell" <Mark.Powell_at_eds.com> wrote in message
>news:1157648680.372714.103310_at_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 --
>>
>I wish it were that simple, but like all books, whenever you start a new
>chapter, the requirement is to reinvent the wheel. I have to use PL/SQL and
>the loops are also a requirement.
>

I would recommend throwing this 'book' in the fire. In that case it is at least of *some* use.

--
Sybrand Bakker, Senior Oracle DBA
Received on Thu Sep 07 2006 - 15:40:18 CDT

Original text of this message

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