How to compare data from the two table column by column and connect the result compared to the separate table

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

Tags: Database

Similar Questions

  • How to save data from the COM port to file?

    Hi all

    can someone tell me please how to save data from the COM port on file? I transfer 1 byte of serial port... attached is the image of the vi... very basic.

    I would like to save the data in a table... I mean, 1 data--> data--> data tab 2 tab 3rd--> tab

    and so on... can anyone help?


  • How to erase data from the iphone if I lost and iphone is offline

    How to erase data from the iphone if I lost and iphone is offline

    < post branched out by host >

    Hello

    What to do if your iOS device is turned off or offline?

    If your missing device is turned off or offline, you can still implement this Mode lost, lockor remote wipe. The next time your device is online, these measures will take effect. If you remove the device from your account while it is offline, pending actions for the device will be cancelled.

    If your iPhone, iPad or iPod touch is lost or stolen - Apple supports

  • How to acquire data from the memory of the meter

    I am a beginner of Labview. I don't know how to acquire data from the memory of the meter.

    I read a few examples of data acquisition, but apparently not similar to my case. I can't use DAQ in my computer, because I don't have DAQ card.

    Could someone give me some pointers? Similar examples would be great.


  • How to recover data from the choicefield retained

    Hello

    How to recover data from the choicefield retained

    Thank you

    SujithRavindran

    getSelectedIndex method will help you.

  • How to transfer data from the 7 Millennium

    How to transfer data from the 7 Millennium

    You will need to manually back up your files by copying and pasting on a device from external storage such as a USB key or external hard drive.

    Then copy them on Windows 7:

  • How to export data from the table with the colouring of cells according to value.

    Hi all

    I use jdeveloper 11.1.1.6

    I want to export data from the table with a lot of formatting. as for color cells based on value and so much. How to do this?

    You can find us apache POI-http://poi.apache.org/

    See this http://www.techartifact.com/blogs/2013/08/generate-excel-file-in-oracle-adf-using-apache-poi.html

  • How to write data from the acquisition of data in NetCDF format?

    I connect to a set of data from the sensor through the DAQ assistant and want to write all data in NetCDF format. I have the required plugins installed, but still can not find how to do this.

    Or the labview can only read the netcdf files, but cannot write it! Please let me know if there is any other way out. I have looked everywhere but could not find something useful!

    Thank you

    Hey,.

    Sorry, the sheet in effect only allows to read NetCDF files, not writing to the NetCDF format.

    Kind regards

    -Natalia

  • How to send data from the client to the server using tcp

    1. as I am new to watch I need help with sending data from client to server. I went through various examples of labview, but each of them also explains transfer of data to the client server. But I need help regardng send data from the server to the client.

    2.i would use the data type variant for sending my data.

    Can someone help me please. Thank you

    Regardless of the meaning. Once you have a connection each end allows it to send data to another. Just create what you want to look like interaction.

    Do you want the client sends a command that request data?
    How do you think the response data to look like?

    You can send variants, but probably not worth the effort.

    Mike...

  • How to load data from the EBS to HFM

    I'm new to HFM. Now, I need to load the data from the EBS to HFM. How can I do this? Version of the EBS is R12.1 and HFM is 11.1.1.3.

    Hello

    Have you looked in the help of FDM 11.1 x version. It has adapters for EBS and you can also map the HFM entities.

    Thank you

    Partnered Bhatti

  • How to delete data from the iPhone 5 c?

    How to remove data from my iPhone 5 c?

    What do you mean by data? Applications, photos, music??  It depends on what you're trying to delete.

  • How to recover data from the browser tabs?

    Hello

    I am trying to retrieve data from the Firefox browser by dragging the tabs in a Windows/Mac/Linux application. Specifically, I was hoping to capture medadata HTML and video current time (for example, 01:23 05:00) YouTube pages for storage off favorite browser and reactivation.

    I couldn't find an online help or the documentation dealing with this issue.
    Any suggestions?

    Thank you

    There is an additional command that is added at the end of the url of Youtube. You need to add & = t * m * s at the end of the url. Where the asterisks are, replace you them with numbers. For example: http://www.youtube.com/watch?v=Zb7gTeLmpHs & t = 3m24s

    The m is s for seconds and minutes.

    You can also find this information by loading a video from Youtube, by dragging the time slider to the time you want to pause the video, and then right-click on the video and choose:

    'Copy the URL of the video at the present time'.

  • How to save data from the RT at base of remote Citadel using Citadel api writing

    I try to get a target RT to launch a VI when it is started, which acquires the data and sends them to a database of Citadel on a networked computer.

    I'm doing it with the Citadel write API, more precisely the functions in the DSC module; Open the trace and write trace close path.

    I have a project with the added goal of RT. I have a simple VI under job-generating data and sending it to the local database of the Citadel. This VI works very well and the data is written to the database. However, I have a similar VI under the RT target but open VI track is broken and the VI will not run. It seems that one of the subVIs in Open Trace VI is broken and will not run.

    I'm missing something here. Can someone help me understand this?

    The VI is probably not compatible with real-time, perhaps she calls a DLL or something. What you need to transfer data from RT on a Windows host computer and let that host the insertion in the Citadel.

    Mike...

  • How to import data from the Excel worksheet file in a table DB using a filebrowse

    Hi friends,

    Im having a table has with the following columns as

    < Li > ID
    < Li > Employee_name
    < Li > Department

    with empty data in it.

    Im having an excel sheet that contains the data for the table has for the column ID < Employee_name < Department

    If it is possible to import excel data sheet empty table A that I have in the DB using a form of front-end APEX which is having a file navigation item only.

    So, if I store that excel sheet using a navigation button in table wwv_flows_files, then automatically all means this sheet file data in the excellent flows_files table must be inserted into the table empty i have.

    It is possible to store the data this way using a browse.

    Brgds,
    Mini

    Hello

    If you're on APEX 4.1 create data loading page. Then the end user may download the CSV data to your table.
    Excel can be saved in CSV format.

    Kind regards
    Jari

    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0

  • How to extract data from the APEX report with stored procedure?

    Hi all

    I am doing a report at the APEX. the user selects two dates and click on the GO button - I have a stored procedure linked to this region of outcome for the stored procedure is called.

    my stored procedure does the following-

    using dates specified (IN) I do question and put data in a table (this painting was created only for this report).

    I want to show all the data that I entered in the table on my APEX report the same procedure call. can I use Ref cursor return? How to do this?

    Currently, I use another button in the APEX that basically retrieves all the data from table. Basically, the user clicks a button to generate the report and then another button for the report. which is not desirable at all :(


    I m using APEX 3.1.2.00.02 and Oracle 10 database.

    pls let me know if you need more clarification of the problem. Thanks in advance.

    Kind regards

    Probashi

    Published by: porobashi on May 19, 2009 14:53

    APEX to base a report out of a function that returns the sql code... Your current code goes against a Ref cursor returns the values...

    See this thread regarding taking a ref cursor and wrapping it in a function to channel out as a 'table' (use a cast to cast tabular function vale)...

    (VERY COOL STUFF HERE!)

    Re: Tyring to dynamically create the SQL statement for a calendar of SQL

    Thank you

    Tony Miller
    Webster, TX

  • How to recover data from the site?

    I just downloaded and installed DW CS6 on my computer and it seems to have completely replaced my old version of DW CS3. I have all my existing data of the site should have exported before doing so, but did not realize until I tried to recover the old data of site. A search on my computer of all the .ste files evokes nothing. I'll have to recreate all these data site from scratch?

    Site data, I guess you mean the files for your Web site.  If this is the case, then the answer is NO, you will not need to recreate from scratch, because during the installation of DW, it does not affect your personal data.

    In addition, when you have installed a newer version of DW CS6, he wrote too much the previous version of your DW CS3.  The two should always be on your hard drive so if you search for it, you will find it.

    If, by chance, you can't find your Web site files, you can download them from your host servers by using external FTP software or simply Import site using the DW module.

    Hope this reassures you that you haven't lost anything.  You can now post more questions to find out how to import or search for files on your hard drive.

    Good luck.

Maybe you are looking for