Get data from 3 differrnt oracle DB & then compare data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Get data from 3 differrnt oracle DB & then compare data
# 1  
Old 10-14-2008
Get data from 3 differrnt oracle DB & then compare data

Hi All,
I have a requirement to write a shell script for the following...
we have 3 different database.... lets say A, B, C
From these 3 DBs, i need to get data.. all have 3 different table...a,b, c
A.a => Emp_code, count(*)
B.b => emp_code, count(*)
C.c => emp_code, copunt(*)
Once get this information, i need to compare these 3 tables using common emp_code
For example, for emp_code=100....
A.a.count(*) = B.b.count(*) & B.b.count(*) > C.c.count(*) If it is true then no action else write to log_file.
Can you please help me how to do it... all are Oracle DB
# 2  
Old 10-14-2008
In addition,

all these 3 table contains more than 100 emp_code...

emp_code Table A.a count Table B.b Count Table C.C count
100 5748 5748 5040
201 2771 2771 1274
202 34 20 13

In this case emp_code 100 & 201 is tru but for 202 it is not tru so that i should be in log file. I also wanted to know how to retrive all information from differenbt table & store it into variable. For one value (emp_code) we can do.. but how about more than 100 emp_code to store in variable & then need to compare?
# 3  
Old 10-14-2008
Could you please post what you have tried so far ? Smilie
# 4  
Old 10-14-2008
Hi Matrix,

I was thinking about using cursor to get the data from all there tables in 3 different Dbs. But my problem is i am not able to think on how to assign these values to variable & compare using one by one. Also, if i write cursor, i can not open all 3 cursors at a time.

Here i got stuck on thinking about this...
# 5  
Old 10-14-2008
I think there are two approaches to do this.

Approach I
To write a complex, costly query that fetches data from multiple db compares and gives the output that is needed - everything in the form of query or to use a stored procedure to do this work. To some extent, after-query processing of data might be needed if everything cannot be achieved via querying from databases ( assuming you are not going for the option of stored procedures). But queries fetching data from multiple dbs don't come for free.

Approach II
Download the required data from each of the db/table and then use a perl/shell script to achieve the same.

The approaches need to be decided purely based on the importance of the application that you are writing. If the databases that are going to be queried are heavily loaded already, then its not worthwhile to use the approach I.

Approach I may not be more suited if the application is like reporting or batch processing that don't have strict timelines ( most of the time ) then its better to switch to approach II.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Compare data - Match first column and compare second

Hi guys, looking for some help with a way to compare data in two files but with some conditions. example, File 1 consists of site1,10.1.1.1 site2,20.2.2.2 site3,30.3.3.3 File 2 contains site1,l0.1.1.1 site2,50.1.1.1 site3,30.3.3.3 site4,40.1.1.1 I want to be able to match the... (1 Reply)
Discussion started by: mutley2202
1 Replies

2. Shell Programming and Scripting

Compare 2 files and match column data and align data from 3 column

Hello experts, Please help me in achieving this in an easier way possible. I have 2 csv files with following data: File1 08/23/2012 12:35:47,JOB_5330 08/23/2012 12:35:47,JOB_5330 08/23/2012 12:36:09,JOB_5340 08/23/2012 12:36:14,JOB_5340 08/23/2012 12:36:22,JOB_5350 08/23/2012... (5 Replies)
Discussion started by: asnandhakumar
5 Replies

3. Shell Programming and Scripting

Sort a the file & refine data column & row format

cat file1.txt field1 "user1": field2:"data-cde" field3:"data-pqr" field4:"data-mno" field1 "user1": field2:"data-dcb" field3:"data-mxz" field4:"data-zul" field1 "user2": field2:"data-cqz" field3:"data-xoq" field4:"data-pos" Now i need to have the date like below. i have just... (7 Replies)
Discussion started by: ckaramsetty
7 Replies

4. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

5. UNIX for Dummies Questions & Answers

Search for & edit rows & columns in data file and pipe

Dear unix gurus, I have a data file with header information about a subject and also 3 columns of n rows of data on various items he owns. The data file looks something like this: adam peter blah blah blah blah blah blah car 01 30 200 02 31 400 03 57 121 .. .. .. .. .. .. n y... (8 Replies)
Discussion started by: tintin72
8 Replies

6. Shell Programming and Scripting

How to incrementally backup data & use most recent data

Hey, dunno if the title really explains this well; basically my problem is (and this is on a router which is why the flash issue)... I have some data I want to store (it's really irelevant, i'm just counting the lines per file, basically a simple counter). I could store this data in flash but... (0 Replies)
Discussion started by: pepsi_max2k
0 Replies

7. UNIX for Dummies Questions & Answers

Howto capture data from rs232port andpull data into oracle database-9i automatically

Hi, i willbe very much grateful to u if u help me out.. if i simply connect pbx machine to printer by serial port RS232 then we find this view: But i want to capture this data into database automatically when the pbx is running.The table in database will contain similar to this view inthe... (1 Reply)
Discussion started by: boss
1 Replies
Login or Register to Ask a Question