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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: surrogate keys or composite?

RE: surrogate keys or composite?

From: Mercadante, Thomas F \(LABOR\) <Thomas.Mercadante_at_labor.state.ny.us>
Date: Tue, 20 Jun 2006 08:29:50 -0400
Message-ID: <ABB9D76E187C5146AB5683F5A07336FF681321@EXCNYSM0A1AJ.nysemail.nyenet>


Amonte,  

Are you asking how do you convert the tables to use a surrogate key? A bit of coding will accomplish this. But your application also needs to be changed so that when it inserts new records, it now creates the records using the surrogate key rather than the natural keys.

The code to convert to surrogate keys is the easy part. Changing your application may be the difficult part.  

Did I answer your question?  

Tom  


From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of amonte Sent: Tuesday, June 20, 2006 6:32 AM
To: oracle-l_at_freelists.org
Subject: surrogate keys or composite?  

Hi all

Reviewing an application over here and came across to an issue, probably not a very big issue but have kept me thinking several days.

The database is designed to report the "workflow" about payments to suppliers in a Big Supermarket. It collects data from at least 6 Transactional systems, i.e 6 data sources.

Considering only the order management reporting module of the database





The supermarket is right now a Organization with a company so we have a company_code
The supermarket has right now 1500 stores so we have a store_code The supermarket operates in 4 countries so we have a country_code We have an order_code
We have a supplier_code
We have an ordering_date

All 6 codes make up the Primary Key for the Order Table The child table of this Order Table (Order details, line by line) is made up of 6 codes plus the line_code

In this database there are quite a few modules which works the same way, composite natural keys to make up the PK. There are a couple of tables whose PK are over 10 columns.

My question is if I wanna use Surrogate Keys how can I make to the rest of world know which key is their parent? How do I publish the Surrogate to the rest of the tables?

--

http://www.freelists.org/webpage/oracle-l Received on Tue Jun 20 2006 - 07:29:50 CDT

Original text of this message

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