Table rpt_pro_elec.pdf and table rpt_pro_elecfee1,
The two tables have the same structure, that is, the primary keys and fields are the same.
The primary keys are: dept_id, trade_code, elec_type_old, elec_type_new, rpt_month, tou_tag, diff_price_type, htrade_code,
Now all I need to do is find records with the same primary key but different values in other fields in the two tables.
========================================================== ======================
Intersect, minus is depressed
SQL> Create Table minus1 (T1 varchar2 (20), T2 varchar2 (20 ));
The table has been created.
SQL> Create Table minus2 (T1 varchar2 (20), T2 varchar2 (20 ));
The table has been created.
SQL> insert into minus1 ('1', '01 ');
Insert into minus1 ('1', '01 ')
*
Row 3 has an error:
ORA-00928: Missing select keywords
SQL> insert into minus1 values ('1', '01 ');
One row has been created.
SQL> insert into minus1 values ('2', '02 ');
One row has been created.
SQL> insert into minus2 values ('2', '02 ');
One row has been created.
SQL> insert into minus2 values ('1', '01 ');
One row has been created.
SQL> insert into minus2 values ('3', '03 ');
One row has been created.
SQL> insert into minus1 values ('4', '04 ');
One row has been created.
SQL> commit;
Submitted.
SQL> select * From minus1 minus select * From minus2;
T1 T2
----------------------------------------
4 04
SQL> (select * From minus1 minus select * From minus2) Union (select * From Minu
S2 minus select * From minus1 );
T1 T2
----------------------------------------
3 03
4 04
SQL> select * From minus1 intersect select * From minus2;
T1 T2
----------------------------------------
1 01
2 02
SQL>
==========================================
Example:
Select to_char (irowukid) from tbrdb09 where id = '2017 _ 1' minus select irowukid from sqsaa. vcooperationinfotemp where id = '2017 _ 1 ';
Select count (*) from sqsaa. vcooperationinfotemp where id = '2017 _ 1' minus select to_char (irowukid) from tbrdb09 where id = '2017 _ 1 ';