Compare two tables, APEX
HelloI am trying to compare two tables, but I want to display values that are the differnet from one to the other,
both tables have the same columns and have the same PK.
Thank you.
Hello
You probably need a report based on a query like this:
SELECT
d1.deptno,
d1.dname,
d2.dname,
d1.loc,
d2.loc
FROM
dept1 d1
INNER JOIN dept2 d2
ON d1.deptno = d2.deptno
AND ( d1.dname <> d2.dname
OR d1.loc <> d2.loc
)
You can also consider using FULL JOIN where you have different values of primary key in both tables and you want to include in the report.
Tags: Database
Similar Questions
-
I want to compare two tables and out a boolean
This should be simple. I want to compare two tables (5 items) and return a single Boolean value (T/F), not an array of Boolean.
Thank you
Kevin
Right click on the comparison, the comparison mode, select compare the aggregates.
-
compare two table with cluster inside
Hello
I want to compare two tables containing a cluster with several groups in it. When you use the equal the result is the same pattern as the cluster of entry. But I just need a true or false. It doesn't bother me that it changed on position 1 or any other position.
Is there an elegant way to do it?
Thanks for any help.
Yves
Right-click equality and change to compare aggregations. That, or add a table and later.
/Y
-
BUG? Statement of BRIDGE to compare two tables
Hello
I tried to compare two tables different dbs and remembered a post on applications to Connectin Cross
http://barrymcgillin.blogspot.com/2010/11/cross-connection-queries.html
I expect to get the differences between the ARB table in my current schema and the table alias temparb arb in the other db. Yet it seems that in this case only the table in my current schema is read.BRIDGE temparb AS "EB05 01" (SELECT * FROM arb) (SELECT * FROM temparb MINUS SELECT * FROM arb ) UNION ALL (SELECT * FROM arb MINUS SELECT * FROM temparb );
I materialize at the table BRIDGE with
and select the value that I know to be only in the remote schemaBRIDGE temparb AS "EB05 01" (SELECT * FROM arb)
Both times I get no results. I even tried to use aliases on the table, same result. Tested in EA3 3.0 and 3.1.SELECT id FROM temparb WHERE id = 2562; SELECT id FROM arb WHERE id = 2562;
Has anyone tried this before?
Concerning
MarcusHi Marcus,
Have you tried without the quotes around the name of connection?
I have a named connection
system_local
which I run the following commanddrop table testbridge_remote;
drop table testdbrige;
create table testbridge (col1 int);
insert into testbridge values (1);
insert into testbridge values (2);
insert into testbridge values (3);
commit;I have a named connection
Name of the connection with space
I performed the following in thedrop table testdbrige;
create table testbridge (col1 int);
insert into testbridge values (4);
insert into testbridge values (5);
insert into testbridge values (3);
commit;Then I can execute the following statement in the connection of system_local/worksheet
BRIDGE testbridge_remote as the name of connection with Space(select * from testbridge)
+ (SELECT * FROM testbridge_remote +)
LESS
SELECT * from testbridge
+)+
UNION ALL
+ (SELECT * FROM testbridge +)
LESS
SELECT * from testbridge_remote
+);+It works well.
Returns the rows in the remote table not in the local table and lines in the local table, not the remote table.Kind regards
Dermot
SQL development team. -
Hello
can you please help me.
How can I compare two table. following my code...
var my_array:Array = Array (5,10,15,20,25,30)
var new_array:Array = Array (7,8,9,10,11,12,13)
for (var i: Number = 0; i < my_array.length; i ++) {}
{if(my_array[i]==new_array[i])}
trace (my_array [i])
}
}Thanks in advance,
JaxNa
Then, you're almost on correct... See the same code that I modified a little,
var my_array:Array = Array (5, 10, 15, 20, 25, 30);
var new_array:Array = Array (7, 10, 9, 10, 10, 30, 13);for (var i: Number = 0; i
If (my_array [i] is {new_array [i]})
trace ("' my Array'" + i + "("+my_array[i]+")"new_array' "+ i +"("+new_array[i]+") = Matching");
} else {}
trace ("' my Array'" + i + "("+my_array[i]+") 'new_array'" + i + "("+new_array[i]+") = is only not to");
}
}If this is not so, explain exactly what you want
-
Hello
I need to compare two tables (T1, T2) and update existing records only in T2, but not in T1. So basically, the lines updated in T2:
Select * from T2 where T2.id not in (select id from T1).
What would be a good way to achieve this in ODI?
I created an ODI interface with a join T2.id not in T1.ID, but it did not work "coz:" ORA-01427: einreihig subquery returns several lines "."
Appreciate any input/access map.
Thank you.Hi Michele...
At first glance, there are at least 2 ways to do it:
(1) put the steps in "(select id from T1)" (you can use an ODI API to get the schema dynamically) as an object filter to T2 (interface), use the incremental update IKM SQL and put "Insert" option on 'No'. " This will do a few updates.
OR
(2) in an interface set the T1 and T2 and left join (based on T2) load a temp table where all fields accept the value zero. Next to the columns to update (of course the T2), create an ID column (I named him as T1_Temp_ID) and map the Id of the T1 to it.
Now just create new interface where the temperature is source and put a filter like "T1_Temp_ID is not null.The first option is less complex and can bring better performance.
The second option gives a better follow-up of the use of the table and the columns, but can be less performatique.This help you?
-
compare two tables and update the differences
Hi all
Sorry for the newbie question, but I am a beginner in the present.
I have two tables, both have same structure-
CODE - code NUMBER (6,0) store is the primary key does not change and is unique
ADDRESS1
ADDRESS2
ADDRESS3 - all VARCHAR2 (100)
One of the tables is named MASTER, the other being updated. MASTER contains hundreds of lines, while the table of UPDATES may have anywhere from zero to 10 or more.
I want to compare the table of UPDATES against the MASTER of the table and if there is a difference, ask the differences in the table in UPDATES to the MASTER of table - so if the address of an Exchange store, then the change is reflected in the MASTER table by crushing with the data contained in the UPDATES table.
I thought that maybe using sliders and compare each field but there must be a more efficient way.
I hope that I have explained quite clearly... any help would be greatly appreciated.
Thank you
BillEducation MERGE, assuming that your version supports supported the MERGER.
SY.
-
How to compare two TABLES and different lines of list?
I have two structural equal paintings aaa and bbb
that (could) have different lines.
How can I compare the tables and display different lines?
PeterSomething like this->
SELECT aaa.*,'bbb' "Not present in" FROM aaa MINUS SELECT bbb.*,'bbb' "Not present in" FROM bbb UNION ALL ( SELECT bbb.*,'aaa' "Not present in" FROM bbb MINUS SELECT aaa.*,'aaa' "Not present in" FROM aaa )
Kind regards.
LOULOU.
-
I have two paintings like these
Table 1 table 2
a 1
a 5 a
b 2 b
c 3 f
d 4 g
e 5 h
f 6
g 7
g 10
h 8
h 9.
with what I have now, I can create a table that lists the matching elements
Results:
a 1
b 2
f 6
g 7
h 8
However, it does not save the two sets of a, g, h, only the first instance. Someone knows how to fix this?
Any help is appreciated
A loop inside another loop FOR FOR should do the trick. Have the index of auto outer loop on the parameters of search and index of auto inner loop on the search table. On a match, add this element to the list.
-
Compare two tables that have columns of nulls and undesirable in where clause
Table A:
col1 col2 COL3 COL4 col5 col6 ANY
NULL VALUE
NULL VALUE
YES
YES
YES
NULL VALUE
NULL VALUE
YES
NULL VALUE
YES
YES
NULL VALUE
ANY
YES
ANY
NULL VALUE
YES
NULL VALUE
NULL VALUE
ANY
YES
YES
YES
Table B:
col1 col2 COL3 COL4 col5 col6 ANY
NULL VALUE
NULL VALUE
YES
ANY
YES
ANY
NULL VALUE
YES
NULL VALUE
YES
YES
NULL VALUE
ANY
YES
NULL VALUE
NULL VALUE
YES
ANY
NULL VALUE
ANY
YES
YES
NULL VALUE
column values
Yes: Current value
No: Null
All: Junk
Must match all columns in TableA to TableB.
TableA.col1 to TableB.col1
.
.
.
TableA.col6 to TableB.col6
Any help is very appreciated
Thank you
Based on your last post that only good data must match exactly and your definition of junk:
WHERE (decode (substr (A.col5, 1, 1), ' ~ ', 'junk mail', null, 'null', 12/31/9999 ', "junk," A.col5 ") = decode (substr (B.col5, 1, 1), ' ~ ', 'junk mail', null, 'null', 12/31/9999 ',"junk", B.col5"))
AND (decode (substr (A.col6, 1, 1), ' ~ ', 'junk mail', null, 'null', 12/31/9999 ', "junk," A.col6 ") = decode (substr (B.col6, 1, 1), ' ~ ', 'junk mail', null, 'null', 12/31/9999 ',"junk", B.col6"))
And so on for the six columns. This assumes that this junk * still * starts with a ~. In addition, it assumes that the unnecessary and null words are not in the form of good data.
-
Compare two tables with Look up table
Hi all
I basically, I have 3 tables T1, T2 and T3 (Look up table)
T1
Col11 Col12
AA 888
AA 444
BB 666
BB 447
BB 478
BB 999
T2
Col21 Col22 Col23
HHH 123 lll
HHH 123 ppp
HHH 123 uuu
GHG 345 kkj
GHG 345 rer
uyy 475 hhh
T3
Col31 Col32
AA 123
AA 345
AA 564
BB 564
BB 475
I need to know if all the correspondence of values (T3. Col31) Q1. Col11 are in T2. If not what are the missing persons
I have this table of correspondence T3 to match between T1 T3
As a data above, I need to get the following out put
T1. Col11 T3. Col32 T2. Col22 T2. Col23
AA 123 hhh lll
AA 123 hhh ppp
AA 123 hhh uuu
AA 345 GHG kkj
AA 345 GHG rer
AA 564 NULL NULL
What type of query, I can use to get the result
See you soon
SexyHello
You just need to use an outer join :)SELECT t1.col11, t3.col32, t2.col22, t2.col23 FROM t1, t2, t3 WHERE t1.col11 = t3.col31 AND t3.col32 = t2.col21 (+)
-
Hello experts...
I'm new to this forum and Oracle coding complex.
I have a task in which I want to compare two tables with the same structure, same columns. My Oracle database is 11g Release 2. I want this column-by-column comparison and save the result in a separate table. (say result_table)
The structure of the table would be as follows:
SQL > desc emp;
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER 4
ENAME VARCHAR2 (10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER (2)
SQL > emp_comp desc;
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER 4
ENAME VARCHAR2 (10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER (2)
Both of the tables EMPNO is the primary key.
I want to compare these two tables based on the EMPNO (EMPNO even is both tables).
The result log table would be as follows:
SQL > create table result_table
2 (check_sr_no, number (5),)
table_name 3 varchar2 (30),
ROW_ID 4 varchar2 (20).
column_name 5 varchar2 (20).
6 column_data varchar2 (1000).
compared_by 7 varchar2 (10));
Table created.
SQL > alter table result_table
2 Add the constraint result_table_pk
3 primary key (check_sr_no);
Modified table.
The name of the table and the name of the column will not be hardcoded (based parameter by user)
I tried to use the dbms_comparison package, but do not find comparison of column to column.
I also used by using the query operator LESS. It's showing the difference in rank.
I also went to https://asktom.oracle.com/pls/apex/f?p=100:11:0:P11_QUESTION_ID:2151582681236
Your help will be very appreciated.
Thank you
DK
Tom Kyte has answered this question MANY times over the years. Here are links for its solution
https://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:4934799800346640847
-
I want to compare two table value is the same, the result I want is can alert 1,5,6, but the result is now only 6
var myText1 = "1,3,5,6."
var myText2 = "+ 1, + 2, 3, + 4, + 5";
var array1 = myText1.split(",");
var array2 = myText2.split(",");
for (var i = 0; i < array1.length; i ++) {}
~ alert (array2.toString (.valueOf (array1 [i])));
If (array2. ToString(). IndexOf (array1 [i]) ==-1) {}
Alert ("havn't" + array1 [i]);
}
}
Hello
Delete "var" on line 14
1,5,6 on my side...
Jarek
-
By comparing the two tables for the integrity of the data
Hi all
I need to compare two tables for the integrity of the data through the SQL query.If you need to compare all the columns of t1 to t2:
(SELECT * FROM t1 MINUS SELECT * FROM t2) UNION ALL (SELECT * FROM t2 MINUS SELECT * FROM t1);
Kind regards
Ankit Rouault
http://theoraclelog.blogspot.in -
Stored procedure to compare two data tables
Hello
I want to have a stored procedure that will compare two tables data (only one column) and remove the line that is not present in the second table.
For example.,.
I have 2 tables called Table1 and Table2, that have the same column called ID (PK).
Data in Table1 are 1,2,3 and data into Table2 are 1.3. When the stored procedure is running, it must compare the ID column in Table1 to ID column in Table2 and since '2' is not there in Table2, I want to remove this line from Table1.
Thanks in advance.delete from table1
where does not exist (select 1 from table2 where table2.id = table1.my_field)
;
Maybe you are looking for
-
Difficult to explain the problem
I have a problem I can not put into words (maybe there is already a topic, but I'm not) so, to see the image as an attachment.
-
Please notify. Problems with updates from a few days ago. Updates, says windows encountered problems and gives the B56 error code. Latest updates were today for KB915597, update windows for windows defender. I'm running windows vista home Basic, serv
-
Speech recognition - dictation and simple tasks
Set up speech recognition. Was able to move to my favorite word processing, writing of LibreOffice. Then tried to open a new document. Said "file." Open File menu. Then he said 'new '. Nothing happened. I couldn't find what command that I use to 'new
-
How can I check which cartridge printer need a change
I don't get a box when I want to print for me of the status of the printer cartridges. I have an Epson Stylus DX7400 and a Samsung R530 laptop. Can someone tell me how to get the status box until it please? Very grateful for your help.
-
Hello team...Last two days I get on my alert-log this error,.I did more things but not solved my problem:SQL > ALTER SYSTEM SET _kgl_large_heap_warning_threshold = 62914560 SCOPE = SPFILE; and restart db.but the error comes back alert-journal .Please