Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Compare utility against two table within the Oracle forums, part of the Databases category; Hi All, I am new user, I have an issue. I am using oracle 9i, it has the two instances, on one instance there are some table and the other ...
|
|||||||
| Oracle Oracle 9i & Oracle 10g Knowledge Base Learn and Share Oracle Technology related articles, white papers, tutorials / study materials, example codes, FAQ's, Tips and Tricks. |
![]() |
| LinkBack | Thread Tools | Display Modes |
|
|||
|
Compare utility against two table
Hi All,
I am new user, I have an issue. I am using oracle 9i, it has the two instances, on one instance there are some table and the other instance there are table. Let table 1 is from the instance one and table 2 is from instance 2. Now i have to make an compare utility against these two table and the compare will be on the column value (column value may be number, float, char, varchar and clob type) and it should be of exact match. I want to log if there is some descripencies with all information. If you have any queries, please let me know or you are founding that the example are not up to understanding i will modify in tabular form. Thanks Anand |
| Sponsored Links |
|
|||
|
Re: Compare utility against two table
Hi Anand,
As per my understanding to ur problem, this can be achieved by writing a procedure where u access the tables of both the instances and compare the column values. I have just given a clue, probably u can make use of this & create ur own procedure. For further queries, feel free to ask. *** Mangai Varma *** |
|
|||
|
Re: Compare utility against two table
Hi Mangai,
Thanks for ur suggestion, i have the same idea but i am unable to write it in the code form. Could you please write a sample query? Thanks Anand |
|
|||
|
Re: Compare utility against two table
Hi Anand,
The following is a sample query which will compare the values from 2 tables. I have used 2 cursors (cursor for loop) so that its simple & easily understandable. I have also used dbms output messages so that the process flow & the result can be viewed during execution. SAMPLE CODE =========== Create or replace procedure comp as l_empno number(5); l_new_empno number(5); cursor l_emp_cur is select empno from emp where sal > 3000 and deptno = 10; cursor l_emp_new_cur is select empno from emp_new where sal > 3000 and deptno = 10; begin for l_emp_rec in l_emp_cur loop dbms_output.put_line('after notfound if l_empno '||to_char(l_emp_rec.empno)); for l_emp_new_rec in l_emp_new_cur loop dbms_output.put_line('after notfound if l_new_empno '||to_char(l_emp_new_rec.empno)); if l_emp_rec.empno = l_emp_new_rec.empno then dbms_output.put_line('same empno'||l_emp_rec.empno||' & '||l_emp_new_rec.empno); else dbms_output.put_line('different empno'||l_emp_rec.empno||' & '||l_emp_new_rec.empno); end if; if l_emp_new_cur%notfound then exit; end if; end loop; if l_emp_cur%notfound then exit; end if; end loop; end; / Using the above sample code, u can generate ur code with more enhancements whichever u require. Hopefully its clear & understandable :-) *** Mangai Varma *** Last edited by Innila; 02-19-2007 at 01:53 AM. Reason: Formatting purpose |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compare values of column in a table | JobHelper | SQL Server | 4 | 03-05-2009 05:37 AM |
| About Utility | Remasri | Windows | 2 | 10-13-2008 10:43 AM |
| WinSnap is a small enhancement utility for taking and editing screenshots. | JobHelper | Geeks Lounge | 0 | 01-31-2007 02:10 PM |
| What is this Utility or Command? | StephenRaj | Windows | 1 | 09-24-2006 05:05 AM |
| What is the Utility used | Bessie | Unix/Linux | 1 | 08-17-2006 02:10 AM |