?
Solved

Oracle reference many tables with one table

Posted on 2014-11-08
2
Medium Priority
?
273 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Suggested Courses

762 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