Home » SQL & PL/SQL » SQL & PL/SQL » Procedure to map 2 tables data
Procedure to map 2 tables data [message #241470] Tue, 29 May 2007 14:07 Go to next message
Mahesh P
Messages: 69
Registered: September 2004
Member
hi all,
i am trying to write a procedure to map the data from 2 similar tables.
there are 2 schemas say schema1 & schema2
Schema1
-------
Table:dtree
docid,docname,docversion,createddate,modifydate
100,file1.txt,1,01/01/2007,01/01/2007
100,file1.txt,2,02/01/2007,02/01/2007
101,file2.txt,1,01/01/2007,01/01/2007
101,file2.txt,2,02/01/2007,02/01/2007

Schema2:
---------
table : schema2.dtree
docid,docname,docversion,createddate,modifydate
190,file1.txt,1,01/01/2007,01/01/2007
190,file1.txt,2,02/01/2007,02/01/2007
191,file2.txt,1,01/01/2007,01/01/2007
191,file2.txt,2,02/01/2007,02/01/2007

here everyting is same except docid in 2 schemas.
now i need to create a table which maps these two records docid.
Ex: i need to create a table in schema2 like
schema2.maptable
schema1docid,schema2docid
100,190
101,191

pls let me know how can i do this.
thanks,
Mahesh
Re: Procedure to map 2 tables data [message #241473 is a reply to message #241470] Tue, 29 May 2007 14:13 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
select a.docid, b.docid
from a, b
where a.xxx = b.xxx and a.yyy = b.yyy and ...
/

Regards
Michel
Re: Procedure to map 2 tables data [message #241484 is a reply to message #241470] Tue, 29 May 2007 15:15 Go to previous messageGo to next message
Mahesh P
Messages: 69
Registered: September 2004
Member
hi michel,
thanks..
i got it..
but i have just given u simple example but in my case there are somany fields to consider..i am trying to find out how to map.
cheers,
Mahesh
Re: Procedure to map 2 tables data [message #241488 is a reply to message #241484] Tue, 29 May 2007 15:23 Go to previous message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is the only way to do it.
You have to list all the fields.
Not so hard to do (you can generate it from dictionary) and you only have to write once.

Regads
Michel
Previous Topic: Logginng/Nologging in User_Indexes Table
Next Topic: Function & Procedure
Goto Forum:
  


Current Time: Thu Dec 08 19:54:24 CST 2016

Total time taken to generate the page: 0.14742 seconds