Home » SQL & PL/SQL » SQL & PL/SQL » Need help with inserting bulk records to the table
Need help with inserting bulk records to the table [message #587401] Fri, 14 June 2013 10:03 Go to next message
diablog
Messages: 3
Registered: June 2013
Location: US
Junior Member
Need advise.

I want to insert bulk records to the table. I want to insert date rows for next 50 years in table ( from year 2001 to year 2050). I have following columns in my table :

YYYYMMDD MM/DD/YYYY Day of the week ( Monday, Tuesday etc) JulianDate

Can anyone pls. help me in developing the script.
Re: Need help with inserting bulk records to the table [message #587402 is a reply to message #587401] Fri, 14 June 2013 10:08 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/


post actual & complete CREATE TABLE statement for the table to be INSERTED.
post a couple of sample INSERT statements that provide the correct column values.
Re: Need help with inserting bulk records to the table [message #587404 is a reply to message #587402] Fri, 14 June 2013 10:23 Go to previous messageGo to next message
diablog
Messages: 3
Registered: June 2013
Location: US
Junior Member
Below is my create table script :

create table dte_dim
(
rptm_cal_key number(09) not null, /* Calendar Key YYYYMMDD */
rptm_cal_day date not null, /* Date MM/DD/YYYY */
rptm_cal_eow date not null, /* End of Week */
rptm_cal_eom date not null, /*End of Month */
rptm_cal_eoq date not null, /* End of Quarter */
rptm_cal_eoy date not null, /* End of Year */
rptm_cal_dow varchar2(10) not null, /* Day of Week Name */
rptm_cal_doy char(03) not null, /* Julian number for that year */
) ;
Re: Need help with inserting bulk records to the table [message #587405 is a reply to message #587404] Fri, 14 June 2013 10:29 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
only a fool or an amateur stores a DATE in a NUMBER field.
It is generally to store any computed value (like End of Week) as static column in any table.
BTW, End of Week varies depending upon your locale or which Calendar being used.

Table can be populated using a single INSERT statement. No PL/SQL is required.
Re: Need help with inserting bulk records to the table [message #587406 is a reply to message #587405] Fri, 14 June 2013 10:33 Go to previous messageGo to next message
diablog
Messages: 3
Registered: June 2013
Location: US
Junior Member
Can you pls elaborate Insert Statement. Monday is first day and Sunday is last day of the week.

[Updated on: Fri, 14 June 2013 10:39]

Report message to a moderator

Re: Need help with inserting bulk records to the table [message #587407 is a reply to message #587406] Fri, 14 June 2013 10:43 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Below should get you going in the correct direction.

 1  select sysdate+level
  2      from dual
  3*     connect by level <= 10
SQL> /

SYSDATE+L
---------
15-JUN-13
16-JUN-13
17-JUN-13
18-JUN-13
19-JUN-13
20-JUN-13
21-JUN-13
22-JUN-13
23-JUN-13
24-JUN-13

Previous Topic: Need all invalid records
Next Topic: Issue with Rownum
Goto Forum:
  


Current Time: Sun Aug 03 12:07:35 CDT 2025