Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating Fact Table

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0

Is there a way to populate a fact table with PL/SQL? I wrote queries and have been trying to use them to insert data into the fact table but am not having much luck.

I can export the data then generate insert statements using other applications, but this seems a bit round about.

Thanks,
DinaZ

(I'm new to Oracle8i)
 
I have a routine that populates my fact table by
(a) populating a cursor that does the aggregation/computation of facts and groups the detail records by the columns I'm using for dimensions.
(b) for each record in the cursor, I get the dimension keys from the dimension tables. If a key cannot be found, then the current dimension value is inserted into the dimension table and the key is then returned.
(c) Once all dimension keys are known, the record is inserted into the fact table.

There are probably better ways to do it, but this works for us, and can reduce a million row detail table to 16 rows of loaded facts (only nine dimensions) in about 18 seconds on a Solaris box w/ two CPUs.
 
carp,

I haven't worked with cursors yet, but I will give it a try.

Thanks,
DinaZ
 
Rather than clutter up the forum with the source code, if you send me your email address I can send you the source code for my procedure (well, early source code, when there were fewer dimensions - but the idea's the same!).
 
carp,

Yes, that would be great. I couldn't find your e-mail address in the forum. My address is: dinaz1@zdnetonebox.com

Thank you,
DinaZ
::)
 
Carp
Can I ask you to send me the source for populating the fact table?
I am at chidiokeh@yahoo.com
thank you!
c.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top