Compare the content of two equal nested tables

I'm working on a black box test where I compare the contents of two structurally equal tables before and after executing a script of some. My two tables, MDQ_OLD and MDQ_NEW, are filled with the data in two separate operations.

The two tables, I'll compare are nested, as you can see in the CREATE TABLE scripts below.

I tried to use the less-operator sign, but without success.

I also tried to select data in a type that is % ROWTYPE to my nested tables, but it does not work as well (see the below script in this post).

Can you please help me on this problem on how to compare the content of two nested tables?

Run the scripts below to reproduce the problem and be sure to update this post if more information is required.

-The scripts below-

Select * from version of v$.

Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

PL/SQL Release 11.2.0.4.0 - Production

CORE Production 11.2.0.4.0

AMT for Linux: Version 11.2.0.4.0 - Production

NLSRTL Version 11.2.0.4.0 - Production

-First of all, I create my types

CREATE OR REPLACE TYPE FORCE AS OBJECT MDQ_DETAIL (NUMBER OF MDQ_DETAIL_ID, MDQ_DETAIL_DESC VARCHAR2 (100));

CREATE OR REPLACE TYPE T_MDQ_DETAIL AS TABLE MDQ_DETAIL;

-Note that this type contains the table T_MDQ_DETAIL type:

CREATE OR REPLACE TYPE MDQ_PARENT FORCE AS OBJECT (NUMBER MDQ_ID, MDQ_DETAILS T_MDQ_DETAIL);

- Then I create two equal nested tables

CREATE THE NESTED TABLE AS MDQ_PR_OLD STORE MDQ_DETAILS MDQ_PARENT MDQ_OLD TABLE.

CREATE THE NESTED TABLE AS MDQ_PR_NEW STORE MDQ_DETAILS MDQ_PARENT MDQ_NEW TABLE.

-Insert test data in the nested tables

Insert into MDQ_OLD (MDQ_ID, MDQ_DETAILS) Values (1, T_MDQ_DETAIL (MDQ_DETAIL(1,'desc1')));

Insert into MDQ_NEW (MDQ_ID, MDQ_DETAILS) Values (2, T_MDQ_DETAIL (MDQ_DETAIL(1,'desc1')));

-Try to use the negative operator to compare the contents of the trailer of the nested tables, but it gives this error:

-ORA-00932: inconsistent data types: expected - got DISPATCH. T_MDQ_DETAIL

Select * from MDQ_NEW

less

Select * from MDQ_OLD;

-Try to select in a ROWTYPE, but it fails

declare

myTypeOld MDQ_OLD % ROWTYPE;

myTypeNew MDQ_New % ROWTYPE;

myTypeDiff MDQ_New % ROWTYPE;

Start

-Select gives: PLS-00497: do not mix between row and several rows (in BULK) list

Select * bulk collect into mdq_old myTypeOld;

Select * bulk collect into mdq_new myTypeNew;

-Need a 'compare the function of membership card' on the types of multiset except to work, but as far as I

-I'm not able to bulk collect into myTypeOld or myTypeNew, this won't help out me.

myTypeDiff: = multiset myTypeOld except myTypeNew.

end;

-Cleaning:

drop table MDQ_OLD;

drop table MDQ_NEW;

type of projection MDQ_PARENT;

type of projection T_MDQ_DETAIL;

type of projection MDQ_DETAIL;

> queries you provided intercepts not who.

You asked how to compare the content of nested tables.

I knew that you didn't ask for what you actually want, that's why I asked you to specify the comparison more in detail.

> Do you have a query that grabs this difference as well?

SELECT o.mdq_id, od.*
OF mdq_old o, TABLE (o.mdq_details) od
LESS
SELECT n.mdq_id, nd.*
OF mdq_new n, TABLE (n.mdq_details) nd;

> Also, if possible, do you have a sample of a statement to COLLECT LOOSE, please?

Actually, you raise an interesting point on using % ROWTYPE, in my view, that should be. This make...

DECLARE
TYPE rt_mdq_new () IS RENDERING
mdq_id NUMBER,
mdq_details t_mdq_detail);
     
TYPE tt_mdq_new IS TABLE OF THE rt_mdq_new;
  
t_mdq_new tt_mdq_new;
BEGIN
SELECT mdq_id, mdq_details
LOOSE COLLECTION t_mdq_new
OF mdq_new min.;
END;
/

DECLARE
CURSOR c_mdq_new
IS
SELECT mn.*
OF mdq_new min.;
     
TYPE tt_mdq_new IS TABLE OF c_mdq_new % ROWTYPE;
  
t_mdq_new tt_mdq_new;
BEGIN
OPEN c_mdq_new.
Get the c_mdq_new COLLECT in BULK IN t_mdq_new;
CLOSE C_mdq_new;
END;
/

Tags: Database

Similar Questions

  • How to compare the content of two files so I can delete duplicate records

    I'm trying to clean up several subfolders with duplicates without looking at the details of each record.  Is it possible in Windows XP to compare the content of two files whether they are an exact replica.

    Hi rav42010,

    Follow the steps in the article.

    Description of the tool in Windows XP disk cleanup

    http://support.Microsoft.com/kb/310312

    You can also use third-party app to perform the task using your favorite search engine.

    Note: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

  • How to compare the content of two Wordpad / documents notebook without reading them line by line?

    How to compare the content of two Wordpad / documents notebook without reading them line by line?

    Hello

    Without this feature is included in the operating system.

    However, you can use your favorite search engine to look for software that needs to perform these tasks.

    WARNING of THIRD PARTY SOFTWARE: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    Hope this information helps.

  • Is it possible to compare the contents of two folders

    Someone copied one of our folders with subfolders on the server from one place to the other. Now, some people use the old location and the new location. Is it possible to compare the two, to find the difference and merge them into a file without losing any information?

    There are third party tools that can automate a large part of it, but you still need to judge what part gets merged from which file.  One of those tools that I know is "Beyond Compare"

    Beyond Compare: <> http://www.scootersoftware.com/index.php >

    Not free, but in my humble OPINION is worth the price.

    HTH,

    JW

  • Compare the contents of the table

    Hi all

    11.2.0.3

    I have EMP_OUT tables both in the database of PROD and UAT. They came out of batch programs run in parallel.

    I want to compare the content of two such identical tables.

    How can I achieve this?

    Thank you all,

    pK

    I don't know that it is very clear in the general forum you think like Tom.

    I look forward to your blog...

  • How compared the content of the two cards

    Hello

    How can I compare the contents of two cards that look like:

    Private map < String, < String, Enum > map > expected;

    Private map < String, < String, Enum > map > real;

    BR,

    Mike

    Actual.Equals (expected);

  • I can't have multiple files open at the same time! I need to compare the content from one to the other. How to display two files at the same time?

    I can't have multiple files open at the same time! I need to compare the content from one to the other. How to display two files at the same time?

    Hi sindres79946597,

    Open Acrobat Reader DC, navigate to the Edit-> Preferences-> General-> uncheck "Open Documents in the new tab in the same window.

    Now, reboot your system, when you open multiple PDFs that all will open in a new window so that you can easily compare.

    Kind regards
    Nicos

  • compare the fields of two queries

    I need to compare the fields of two queries.

    I went through many articles to asktom help operator less. but I'm not convinced by this method.

    Comaprisons are for about 10 fields.

    So I'm planing to do using sliders and nested loops. performance can be a problem.

    Please give your suggestions or solutions.

    OK, using the data you provided, I get this:

    with map_test_fac as (select 100 idid, 789 ifid, 300 edid, 741 efid from dual union all
                          select 100 idid, 123 ifid, 300 edid, 963 efid from dual union all
                          select 100 idid, 456 ifid, 300 edid, 258 efid from dual),
             test_fac as (select 741 facid, 'ETY' type, 'EUR' ccy, 'Ext' src, 300 did from dual union all
                          select 789 facid, 'WE' type, 'EUR' ccy, 'Int' src, 100 did from dual union all
                          select 123 facid, 'VPR' type, 'EUR' ccy, 'Int' src, 100 did from dual union all
                          select 456 facid, 'ETY' type, 'USD' ccy, 'Int' src, 100 did from dual union all
                          select 963 facid, 'WE' type, 'EUR' ccy, 'Ext' src, 300 did from dual union all
                          select 258 facid, 'VPR' type, 'EUR' ccy, 'Ext' src, 300 did from dual)
    -- end of mimicking your data: USE SQL below:
    select tfi.facid int_facid,
           tfi.type int_type,
           tfi.ccy int_ccy,
           tfi.src int_src,
           tfi.did int_did,
           tfe.facid ext_facid,
           tfe.type ext_type,
           tfe.ccy ext_ccy,
           tfe.src ext_src,
           tfe.did ext_did
    from   test_fac tfi,
           test_fac tfe,
           map_test_fac mtf
    where  mtf.ifid = tfi.facid
    and    mtf.efid = tfe.facid
    and    mtf.idid = tfi.did
    and    mtf.edid = tfe.did
    and    (tfi.type != tfe.type
            or tfi.ccy != tfe.ccy)
    
     INT_FACID INT INT INT    INT_DID  EXT_FACID EXT EXT EXT    EXT_DID
    ---------- --- --- --- ---------- ---------- --- --- --- ----------
           789 WE  EUR Int        100        741 ETY EUR Ext        300
           123 VPR EUR Int        100        963 WE  EUR Ext        300
           456 ETY USD Int        100        258 VPR EUR Ext        300
    

    However, I think that your mapping data is incorrect, so with keys of information:

    with map_test_fac as (select 100 idid, 789 ifid, 300 edid, 963 efid from dual union all
                          select 100 idid, 123 ifid, 300 edid, 258 efid from dual union all
                          select 100 idid, 456 ifid, 300 edid, 741 efid from dual),
             test_fac as (select 741 facid, 'ETY' type, 'EUR' ccy, 'Ext' src, 300 did from dual union all
                          select 789 facid, 'WE' type, 'EUR' ccy, 'Int' src, 100 did from dual union all
                          select 123 facid, 'VPR' type, 'EUR' ccy, 'Int' src, 100 did from dual union all
                          select 456 facid, 'ETY' type, 'USD' ccy, 'Int' src, 100 did from dual union all
                          select 963 facid, 'WE' type, 'EUR' ccy, 'Ext' src, 300 did from dual union all
                          select 258 facid, 'VPR' type, 'EUR' ccy, 'Ext' src, 300 did from dual)
    -- end of mimicking your data: USE SQL below:
    select tfi.facid int_facid,
           tfi.type int_type,
           tfi.ccy int_ccy,
           tfi.src int_src,
           tfi.did int_did,
           tfe.facid ext_facid,
           tfe.type ext_type,
           tfe.ccy ext_ccy,
           tfe.src ext_src,
           tfe.did ext_did
    from   test_fac tfi,
           test_fac tfe,
           map_test_fac mtf
    where  mtf.ifid = tfi.facid
    and    mtf.efid = tfe.facid
    and    mtf.idid = tfi.did
    and    mtf.edid = tfe.did
    and    (tfi.type != tfe.type
            or tfi.ccy != tfe.ccy)
    
     INT_FACID INT INT INT    INT_DID  EXT_FACID EXT EXT EXT    EXT_DID
    ---------- --- --- --- ---------- ---------- --- --- --- ----------
           456 ETY USD Int        100        741 ETY EUR Ext        300
    

    That's more like what you're looking for?

  • How can we do a single element with the content of two clips

    How can we do a single element with the content of two clips

    You try to get a picture of image? In other words, that contained two visible clips at the same time? If you are, change the substantive item to you main plot and another tie on top using an edit connect to the battery. Select the top item. Activate the transform tool and resize and reposition the clamp if necessary.

    Russ

  • How can I compare the differences between two files After Effects?

    I have a major problem.  I was working on special effects for a film.  In After Effects, when I change siggificant, I often have to register under and create a new name so I can go back to the old work if necessary.  It comes in a case, I have come back from earlier works.  If I use these two files After Effects allows you to create multiple clips of effects.  And I do not remember just where you look at it, it is better.  Does anyone know a good way to compare the differences between the files?

    One thing to keep this conversation on the right way: I know that I did a stupid thing.  I've never done this before so can we please not spend a lot of time on how to avoid this problem and stick to how we solve this problem?

    If you encounter difficulties to identify differences in the old and new versions, you can use this procedure:

    To avoid confusion, I'll call your former company and your most recent compositions CompB comps.

    CompA drag "New Comp" icon in the project window.  This will create a new temporary layout that contains the nested CompA.

    Drag in your new COMP CompB temporary ensure it aligns image for image with CompA.

    Place the top layer (CompB) difference.

    Now, when you play through the comp, you'll see differences in color at a time where the comparison and CompB are not identical.

  • How to compare the value of two combo

    I have two Combo Box (cbFirst & cbSecond). I want to compare the value that has been selected by the user and according to the result, the output is displayed. In the two combo box, I have provided the value.

    Here is my code:

    var a: number;
    var b:Number;

    function First(evt:Event):void {}
    a = evt.target.value;
    trace (a);
    }
    cbFirst.addEventListener (Event.CHANGE, first);

    function Second(evt:Event):void {}
    b = evt.target.value;
    trace (b);
    }
    cbSecond.addEventListener (Event.CHANGE, second);

    If (a > b) {}

    trace ("more")

    on the other

    trace (b is higher);

    Trace the statement inside the functions work very well and the value correct a & b is printed. But the comparison in the if statement does not seem to work. Could you please help me.

    There is a typing error.  Fix it or delete it:

    var a: number;
    var b:Number;

    function First(evt:Event):void {}
    a = evt.target.value;

    trace (a);
    compareF();
    }
    cbFirst.addEventListener (Event.CHANGE, first);

    function Second(evt:Event):void {}
    b = evt.target.value;
    trace (b);

    compareF()
    }
    cbSecond.addEventListener (Event.CHANGE, second);

    function compareF() {}

    If (a > b) {}

    trace ("more")

    on the other

    trace (b is higher);

    }

  • I want to compare the 'brightness' of two images using a template image and an image acquired

    For the most part looking for suggestions on the best way to go about it. Im trying to run a test that will allow me to compare the brightness of an LCD screen using a webcam. Essentially, I let power on the screen, and from time to time, the screen will be incredibly dim. IM thinking I should be able to use the functionality of the subtraction with both images and if I have a normal screen it should produce a closure to 0 results, while the dark screen should give a non zero value (pixel wise) but have so far not been successful.

    http://zone.NI.com/reference/en-XX/help/370281AA-01/imaqvision/imaq_light_meter__point/  I used the rectangle version but this block instead of going with a subtraction! Being new on and auto teaching labview I often oversteps these easy solutions

  • How to compare the contents of the cell against a series list range of values?

    Hi all! I really need help.

    I have tried to help myself using the formula of numbers and other discussions Apple guide but do not find a method using the info. Unfortunately, in two days and no work done, I feel rather useless! I read the guides but I can't understand the syntax, or the use, if, AND, OR, etc..

    I have a list of about 800 alphanumeric codes. There are about 80 I want to "stand out". About 30 of them I can isolate content in the adjacent cell, but the other 50 are repeats of the first 30 but are without cells adjacent "filterable" so I can't isolate easily. I thought that I could create a formula that would give rise to 'TRUE' IF (-none of the 30 listed alphanumeric codes appear in column A). Something like:

    = IF (A2 = (AFS4572 OR HFU9372 OR UWK1993 OR EPD5490), "TRUE", "FALSE")

    or written more readable

    = IF (A2 = (AFS4572, HFU9372, UWK1993, EPD5490), 'TRUE', 'FALSE')

    Can someone help me with a formula?

    Or at least some information on:

    (a) how to think straight

    (b) recommend a reasonable way to learn the syntax of the formula numbers?

    Hello

    COUNTIF() would be your friend as shown in column B in the following example. Column C shows how to use the OR() function if you have a particular reason to select.

    For example,.

    Table 1 (excerpt)
    
    A1  code
    A2  HFU9372
    A3  EPD5490
    A4  AFS4572
       
    B1 
    B2  =COUNTIF(CODES::A,A2)>0
    B3  =COUNTIF(CODES::A,A3)>0
    B4  =COUNTIF(CODES::A,A4)>0
       
    C1 
    C2  =OR(A2="AFS4572",A2="HFU9372",A2="UWK1993",A2="EPD5490")
    C3  =OR(A3="AFS4572",A3="HFU9372",A3="UWK1993",A3="EPD5490")
    C4  =OR(A4="AFS4572",A4="HFU9372",A4="UWK1993",A4="EPD5490")
    

    Notes.

    Formula in B2 and C2 can be filled down.

    The table is bulit with numbers v2.

    Kind regards

    H

  • is it possible for the owners of two for one table in oracle?

    SQL > select table_name, master
    dba_tables 2
    3 where table_name = "DEPT";

    TABLE_NAME OWNER
    ------------------------------ ------------------------------
    MANO DEPT
    SCOTT DEPT

    SQL >
    SQL >
    SQL > show user;
    The USER is "MANO".

    Hello
    This isn't two owners for 2 tables but twotables and two owners.
    Log in as a Mano
    make one

    insert into dept values (blahh..blahh..);
    commit;
    

    Now the connection as scott

    select * from dept;
    

    You will see the difference.
    What you should understand, is there are physically two tables belonged to two different users with the same name.
    Hope he get out of your confusion.

    See you soon!
    Bobin

  • Can I combine the contents of two PDF files?

    Hello

    I want to merge two PDF files with the first pdf data.

    Please look in the photo below.

    This isn't just I wnt to merge two PDF files, but also I want to remove the white space of the high pdf.

    can do us. Please let me know if we can do it.

    Concerning

    Sunil Gupta

    You can merge two PDF using LiveCycle assemble files, but you will not be able to "sink" PDFs together unless they are both XFA forms. If this is the case, then you'd called 'formula couture' to add two models together, so the model that should be activated in a PDF file.

    Make sense?

    Paul

Maybe you are looking for