Solved

Oracle reference many tables with one table

Posted on 2014-11-08
2
268 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
2 Comments
 
LVL 34

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

821 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