compare columns between tables [message #320186] |
Wed, 14 May 2008 04:46  |
Hero_2007
Messages: 2 Registered: May 2008 Location: London
|
Junior Member |
|
|
I am new here and to Oracle, so please be gentle.
I am trying to compare columns in two existing tables 'T_CLASSNAME' and 'T_ATTRIBUTES'
Both tables have the columns called 'CLASS' that contains class name such as 'SWITCH' and 'ATTRIBUTES' that contains attributes associated with the class such as 'HEAT' or 'SIZE'. The 'ATTRIBUTES' in 'T_ATTRIBUTES' is updated regularly.
The aim is to write a procedure that will allow 'T_CLASSNAME' to check with 'T_ATTRIBUTES' to see if any new attributes has been added for a particular CLASS, if so add the new attributes into the 'T_CLASSNAME' table.
I hope this make sense, any help would be appreciated, many thanks.
|
|
|
|
|
Re: compare columns between tables [message #320216 is a reply to message #320202] |
Wed, 14 May 2008 05:48   |
S.Rajaram
Messages: 1027 Registered: October 2006 Location: United Kingdom
|
Senior Member |
|
|
Browse this forum and you will understand what I mean by posting the sample data and how they have done it and following the same. Most important is read the forum guidelines on how to format your post before posting it.
Regards
Raj
|
|
|
Re: compare columns between tables [message #320236 is a reply to message #320216] |
Wed, 14 May 2008 07:11   |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
@Raj I would not consider it spoon feeding to tell a newbie poster exactly how to post sample data. 
@OP post create table statements and insert statements like so:
CREATE TABLE table1 (colA Number, Colb VARCHAR2(20));
CREATE TABLE table2 (col2A Number, col2b number, col3 date, col4 varchar2(10));
INSERT INTO table1 VALUES (1, 'Spike');
INSERT INTO table1 VALUES (2, 'Tom');
INSERT INTO table1 VALUES (3, 'Jerry');
INSERT INTO table2 VALUES (1, 2, SYSDATE, 'X');
INSERT INTO table2 VALUES (2, 2, SYSDATE, 'Y');
INSERT INTO table2 VALUES (3, 1, SYSDATE, 'AB');
That way, people can get a better idea of your data and can play about with it more easily to help you out.
Also remember to post what you would expect the result to be from your query.
But before you go any further, have a look at the forum guidelines here
|
|
|
|
|