Home » SQL & PL/SQL » SQL & PL/SQL » read only column in table
read only column in table [message #184750] Thu, 27 July 2006 14:00 Go to next message
Messages: 90
Registered: July 2005
I have a master table which has say 2 columns

Id Name
1 Arizona
2 Baltimore

There is a detail table (basically links to the above table). The columns are

Id Name Value
1 Arizona 1233
2 Baltimore 85656

Ideally we should not be having the Name column in this detail table. But I want to have the Name column in the Detail Table too. The main reason is so when one looks at the table in the database, at a glance one knows what name the ID is. This is more for the developers ease.

Is there any way the name column in the detail table be safeguarded against accidental updates? I can think of creating a unq key and then a foreign key that references the master table. THough it will ensure that it has all the values the master table has, there is always a chance id 1 in detail can be updated as baltimore and id 2 as arizona. Causing a discrepancy.

What I am wondering is can a column in a table be a read only column or even every time the detail table is viewed it gets the name information from the master table?

thank you

Re: read only column in table [message #184761 is a reply to message #184750] Thu, 27 July 2006 16:44 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
"Developers ease"? Do the developers not know how to do a simple join? Why you would compromise the database design to avoid a join is beyond me, especially because of all the extra coding necessary to try and prevent the update to that column in the detail table.
Re: read only column in table [message #184930 is a reply to message #184761] Fri, 28 July 2006 15:10 Go to previous message
Messages: 619
Registered: July 2006
Senior Member
For developers ease - define a view.

Previous Topic: another undocumented?
Next Topic: NLS_DATE_FORMAT from 10g client to 8i database
Goto Forum:

Current Time: Sat Jul 22 22:25:46 CDT 2017

Total time taken to generate the page: 0.04389 seconds