Solved

Oracle reference many tables with one table

Posted on 2014-11-08
2
271 Views
Last Modified: 2014-11-09
I have a number of solutions for this problem but want to choose the correct one and hope to hear a consensus of what experts think one having one table (Notes) which can have references to many tables.

So imagine you have a Company, User and Trade table.  Users belong to companies and trades belong to users which is all well laid out.  Now, I have to resolve the issue of how to resolve Notes because each of those tables can have notes.  So you can have notes for a person and/or company and/or trades.

What is the best way to implement this?

Oracle 12c with millions of rows per year with a minimum of 7 years activity.

Any help is GREATLY appreciated.

Thanks in advance,

B
0
Comment
Question by:cyimxtck
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
johnsone earned 500 total points
ID: 40431146
Single table:

NOTES
NOTE_ID       NUMBER
NOTE_TXT      VARCHAR2(4000)
CREATE_DATE   DATE

Primary key NOTE_ID.  Partition by CREATE_DATE to make truncating out notes easier.  I don't see a performance gain there because the date won't be part of any query.

If you need multiple fields, add a NOTE_SEQ field to sequence the records associated with the NOTE_ID.

All tables that have a note would have a foreign key to this table.

To drop out old notes,  you would have to update the NOTE_ID of the referencing tables to NULL and then drop the partition.
0
 

Author Closing Comment

by:cyimxtck
ID: 40431246
What I needed for sanity!
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  â€¦
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question