analyze the differences between the 2 tables

Hi all
I have two tables, more or less the same. Suppose that the tables are the same for now (same columns, data types).
One contains lines that are not in the second, the second contains documents that are not in the first table.
How can I write a select statement would separate the lines 2 and not 1, lines 1 and not 2 and the municipality.
I've already solved it by a bit of PL/SQL code, however, I'm looking for something elegant...

Thank you
Kowalsky

Use less and union.

I think that I read it wrongly...

for joint - intersect
for diff - less
for the union to diff - union and less

By
VAMSi

Published by: Vamsi Kasina on June 20, 2009 12:53 AM

Tags: Database

Similar Questions

  • Difference between FA_CATEGORIES_B and table FA_CATEGORIES_TL

    Hi all 2

    Anyone know what what is difference between sub reference tables

    FA_CATEGORIES_B
    FA_CATEGORIES_TL
    FA_CATEGORY_BOOKS
    FA_CATEGORY_BOOK_DEFAULTS


    Kind regards


    Lavenu

    Hello.

    FA_CATEGORIES_B stores information about your asset classes. This
    table provides information by default when you add an asset. The
    amortization schedule does not use this information to calculate
    depreciation.

    FA_CATEGORIES_TL contains the translated column from the base FA_CATEGORIES_B description
    Table complies with multlLingual.
    FA_CATEGORY_BOOKS provides accounts of cost and of the reserves for a book
    and the combination of the category.
    The form of the asset classes inserts a line in the following table for each book
    in which you use an asset class. For example, if you set one
    category for three of depreciation, active Oracle inserts three
    rows in this table.

    FA_CATEGORY_BOOK_DEFAULTS provides values default to the
    rules of depreciation when you add an asset.
    The form of the asset classes inserts a line in this table
    for each class of assets, amortization and date
    place in the range of service for which you are setting up the category.

    Octavio

  • Difference between an XMLType table and one table with an XMLType column?

    Hi all

    Still trying to get my mind on all that XML stuff.

    Can someone explain briefly the difference between:
    create table this_is_xmltype_tab of xmltype;
    and
    create table this_is_tab_w_xmltpe_col(id number, document xmltype);
    What are the advantages and disadvantages of each solution? How are they really different?

    Thank you

    -Mark

    Sorry Mark, as far as I know it is not a real difference despite the fact that you can use the table with the column (ID), probably more effective for document-focused while driving the query via the ID column and anything else I can think off automatically about XMLType contra XMLType table columns is that (as far as I KNOW) you can not use a column of XMLType to shred the data into it via WebDAV o FTP. But then again I never really tried to do an XMLType column-based. Alternatives, for example, a binary XML column begins with a column of $ sys_nc_oid which is indexed, so in principle you shouldn't need an ID (number) column that has an index (a read also on http://www.liberidu.com/blog/?p=494). If there has been non-null that you could use this index for document oriented applications.

  • The differences between CAT and table TAB

    1. What is the difference between cat and TAB?
    2. why TAB does not exist in dict?
    3. that the same situation for cat and TAB?

    Thanks a lot for your answer kindly.

    sys@ORCL > cat desc
    Name Null? Type
    ----------------------------------------------------- -------- ------------------------------------
    TABLE_NAME NOT NULL VARCHAR2 (30)
    TABLE_TYPE VARCHAR2 (11)

    sys@ORCL > tab desc
    Name Null? Type
    ----------------------------------------------------- -------- ------------------------------------
    TNOM NOT NULL VARCHAR2 (30)
    TABTYPE VARCHAR2 (7)
    NUMBER OF CLUSTERID

    sys@ORCL > select * dict where table_name = "CAT";

    TABLE_NAME COMMENTS
    ---------- -----------------------------------
    Synonym of cat for USER_CATALOG


    sys@ORCL > select * dict where table_name = 'USER_CATALOG ';

    TABLE_NAME COMMENTS
    -------------------- -----------------------------------------------------------------
    USER_CATALOG Tables, views, synonyms, and sequences belonged to the user

    You've posted enough to know that, for each position, you will need to provide your version of Oracle 4-digit (SELECT * FROM V$ VERSION)
    >
    1. What is the difference between cat and TAB?
    2. why TAB does not exist in dict?
    3. that the same situation for cat and TAB?
    >
    1, 2, 3 - TAB has been deprecated then don't use it.

    Definitioni of base for those located in the reference database
    http://docs.Oracle.com/CD/B28359_01/server.111/b28320/statviews_2127.htm#sthref1535
    >
    CAT

    CAT is a synonym for USER_CATALOG.
    . . .
    USER_CATALOG

    USER_CATALOG lists all the tables, views, clusters, synonyms, and sequences belonged to the current user. Its columns are the same as those of "ALL_CATALOG".
    . . .
    DICT

    DICT is a DICTIONARY.
    . . .
    DICTIONARY

    DICTIONARY contains descriptions of data dictionary tables and views.
    . . .
    TAB

    TAB is included for compatibility. Oracle recommends that you do not use this view.
    >
    TAB has been deprecated. He looks like the cat because it shows the USER objects, but it does not show the sequences, like the cat.

    If you look at the source code for the views TAB and USER_CATALOG you can see the differences. This code is copyrighted by Oracle Corporation, all rights reserved.

    /* Formatted on 1/1/2013 8:50:07 AM (QP5 v5.115.810.9015) */
    CREATE OR REPLACE FORCE VIEW SYS.TAB
    (
       TNAME,
       TABTYPE,
       CLUSTERID
    )
    AS
       SELECT   o.name, DECODE (o.type#,
                                2,
                                'TABLE',
                                3,
                                'CLUSTER',
                                4,
                                'VIEW',
                                5,
                                'SYNONYM'), t.tab#
         FROM   sys.tab$ t, sys."_CURRENT_EDITION_OBJ" o
        WHERE       o.owner# = USERENV ('SCHEMAID')
                AND o.type# >= 2
                AND o.type# <= 5
                AND o.linkname IS NULL
                AND o.obj# = t.obj#(+);
    . . .
    /* Formatted on 1/1/2013 8:54:45 AM (QP5 v5.115.810.9015) */
    CREATE OR REPLACE FORCE VIEW SYS.USER_CATALOG
    (
       TABLE_NAME,
       TABLE_TYPE
    )
    AS
       SELECT   o.name,
                DECODE (o.type#,
                        0, 'NEXT OBJECT',
                        1, 'INDEX',
                        2, 'TABLE',
                        3, 'CLUSTER',
                        4, 'VIEW',
                        5, 'SYNONYM',
                        6, 'SEQUENCE',
                        'UNDEFINED')
         FROM   sys."_CURRENT_EDITION_OBJ" o
        WHERE   o.owner# = USERENV ('SCHEMAID')
                AND ( (o.type# IN (4, 5, 6))
                     OR (o.type# = 2 /* tables, excluding iot - overflow and nested tables */
                         AND NOT EXISTS
                               (SELECT   NULL
                                  FROM   sys.tab$ t
                                 WHERE   t.obj# = o.obj#
                                         AND (BITAND (t.property, 512) = 512
                                              OR BITAND (t.property, 8192) = 8192))))
                AND o.linkname IS NULL;
    
  • Difference between a logical table duplication and creation of an alias

    Hello

    I have a question of basic theory.

    What is the difference between creating a duplicate in the MDB layer and creation of an alias physical and important in the MDB layer.

    I want to join the physical object to two facts and import that into MDB layer and duplicate the object logic and create an individual join for each of the entities in the MDB layer. This kind of structure will have any negative impact on the final result.

    Any suggestions on this will be greatly appreciated.

    Thank you

    This is for OBIEE10g

    FYI; Here it is my comments

    Assuming the column rename in MDB for the same physical object is supplied to this kind of approach ;)

    I suggest go by best practice or how consistency.
    A logical table should have a ref source of physical layer.
    Logic or presentation column should have at least one physical source directly or indirectly (buy from the other logical column)

    Would it help to have their own hiearchies dimension for each logical table, just in case you duplicate an existing logical table for which there is a dimension existing in the model you get consistency error.

    When you joined the MDB you may need to set the join by foreign key (which have a condition) in MDB instead of complex join logical layer.

  • analyze the table &amp; dbms_stats (chained lines)

    Hi guys,.

    Understand that dbms_stats collect statistics on (chained rows).
    To get chained lines, we can use one of the below:
    1. analyze the < table_name > table list chained rows;
    2 analyze the table < table_name > statistical calculation;

    the first lists the information chained rows in the CHAINED_ROWS table.
    the 2nd is best so that the information of chain_cnt are fulfilled in dba_tables. I can easily get the percentage of channel count by diviiding with the num_rows (for example if you need to list tables with 10 > string cnt percentage it would be easy).

    Right now, I'm leaving the need to collect statistics for night work by default oracle (who gather for table with variation in percentage of stale or > 10)... However, come together to string cnts.
    Can advise how can I get the string cnt without risking my existing services?

    And also will analyze statistics of table < table_name > estimate; replace my existing histograms?

    Thank you

    Published by: Chewy on March 4, 2013 02:35

    Can advise how can I get the string cnt without risking my existing services?

    analyze the table list chained rows in ;

    Select owner_name, table_name, count (*) from the group by owner_name, table_name;

    CHAINED_ROWS_TABLE must be created with UTLCHAIN. SQL script

  • Analyze the table after loading

    Hi gurus

    Let me know how we analyze the target table after loading to finish using an interface.

    Concerning
    Sree

    Hi Mary,

    There are two ways to do it,

    1. customize your IKM own target of Analyze table step added.

    2. create a procedure of ODI which will analyze the target table and can be called after the success of the loading data.

    Thank you
    Guru

  • Ordinary table from the temporary table vs

    Hello
    What is the difference between a temporary table and a regular ODI table.

    I created a temporary table mapping. Works very well. Now, I added the column in the mapping. To make it work, I have to drop the temporary table that created starting from my previous run or add the column in the temporary table. So I was wondering what is the difference between temp and a regular table in terms of maintenance.

    How can I make adding new dynamic columns.

    -app

    Just to add to what others have said.

    (Temporary interface or yellow Interface) to create (Temp Table or Table Stagging)
    -------------------------------------------------------- ----------------------------------------------------------------

    This method is used to create a temporary Table or Stagging table so that you can export your data before the load in the main target.
    Also its always good practice to create them in the scheme of work (where $ tables are created), except if you required in your database schema.
    This interface are marked by yellow color
    Also these Interface can be dragged directly into all other Interfaces.

    The main reason why they are not removed or delete which is then we cannot call in the following Interface to load the target.

    tables of $
    ------------

    Here's the ODI tables it creates before loading the data into the target as ODI works with ELT concept where his charges into a temporary table (C$, I$, $ J etc.). ODI after loading data in these tables $ can do the necessary transformation and finally load into the target table.
    Once the loaded data to compeltely there ' won't be any use of these tables so they let down, even if you have not deleted by havingthe option
    Delete temporary objects - not in LKM and IKM. Generally used for debugging, but once you have finished debugging, make sure that you return Yes, ODI else will not remove these tables of $.

    How can I make adding new dynamic columns.

    Although I see no reason to drop the temporary table or tables intermediaries. Its good to drop in the database and run your IKM, but again please find a way to do it using revenge for your reference.

    Step 1 - create a copy of your IKM

    Step 2 - Add another command called Drop Target Table and use the following code

     Drop table  <%=snpRef.getTable("L", "TARG_NAME", "A")%> 
    

    Move it before you create the target Table.

    Step 3. Added an option - Drop Table target, so that you can specify whether to drop or not. Go on command and option and instead of always run, check the Drop target only Table option.

    That way if you do not want to delete the target table, it used to other specify Yes.

    I hope this helps.

  • difference between icx_sessions and fnd_logins

    Hello

    Usually we use both fnd_logins and icx_sessions tables to find the number of users connected to the application as well as fnd_user.

    What is the main difference between these two tables?

    -Thank you

    Hello

    You are right.

    Kind regards

    Bashar

  • difference between aq$ wf_notification_out and wf_notification_out

    Hello

    What is the difference between above two tables?

    The two stores data on outbound notifications, but I can't the two tables have different column names.

    -Thank you

    OK - pl see the code behind the view - he joined 3 items, one of them being WF_NOTIFICATION_OUT of table

  • What is the difference between the type of table and view?

    Hello world.

    What is the difference between the type of view and table that we can set using SQL statement such as: "tab type is table of...» » ?

    A view is a stored query.

    An array type is a construction of PL/SQL.

    Both are documented:

    http://docs.Oracle.com/CD/E11882_01/server.112/e10897/schema.htm#ADMQS0841

    Management of schema objects

  • What is the difference between associative arrays and nested tables?

    Hello
    What is the difference between associative arrays and nested tables?

    nested tables cannot be indexed by other than pls_integer and unlike nested tables table associative cananot be declared at the schema level.

    is there any other difference set apart from the diff above 2?

    user13710379 wrote:
    What is the difference between associative arrays and nested tables?

    Name-value pairs (associative) against a list of values (table standard/nested table).

    nested tables cannot be indexed by other than pls_integer

    They are not "indexed" the way in which an associative array is indexed. A standard table is referenced by the position of the cell in the table. This position is essentially the offset of the memory of the cell from the start address of the table.

    Can not solve a cell in an associative array directly via a memory offset index. You place a cell reference value it by his 'name' (a search in the linked list/hash table).

    The following example shows the difference between the pairs of name / value and a list of core values.

    SQL> declare
      2          --// associative arrays are NAME-VALUE pairs
      3          type TArr1 is table of varchar2(10) index by pls_integer;
      4          type TArr2 is table of varchar2(10) index by varchar2(10);
      5
      6          arr1    TArr1;
      7          arr2    TArr2;
      8  begin
      9          arr1(100) := '1st entry';
     10          arr1(1) := '2nd entry';
     11          arr1(5) := '3rd entry';
     12
     13          arr2('john') := 'New York';
     14          arr2('jane') := 'Paris';
     15          arr2('jack') := 'London';
     16
     17  end;
     18  /
    
    PL/SQL procedure successfully completed.
    
    SQL>
    SQL>
    SQL> declare
      2          --// standard arrays are lists
      3          type TArr3 is table of varchar2(10);
      4          type TArr4 is table of number;
      5
      6          arr3    TArr3;
      7          arr4    TArr4;
      8  begin
      9          arr3 := new TArr3( '1st entry', '2nd entry', '3rd entry' );
     10
     11          arr4 := new TArr4( 100, 1, 5 );
     12  end;
     13  /
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • The most elegant way to get the difference between two tables - not least!

    Hello


    Simplified example of what I'm trying to achieve - I have two tables ORIGINAL and REVISED.


    My aim is to compare the two, such as; -


    When there is data in the two tables I get the difference between the Budget column, and if there is no difference, so I don't want no lines.

    When data exists in the ORIGINAL, but not in review, I want to the inverse of the current value of the Budget column.

    Where the data exist in REVISED I want the REVISED value.

    I can see how I can do this, see below, but is there a more elegant solution?




    Data for the ORIGINAL table
    select '801040' entity, '2186' expense_type, 234000 budget
    from dual
    union all
    select '801040' entity, '3001' expense_type, 1000 budget
    from dual
    union all
    select '801040' entity, 'P132' expense_type, 34000 budget
    from dual
    union all
    select '801040' entity, 'P135' expense_type, 43000 budget
    from dual
    Data for the REVISED table
    select '801040' entity, '2186' expense_type, 235000 budget
    from dual
    union all
    select '801040' entity, 'P132' expense_type, 34000 budget
    from dual
    union all
    select '801040' entity, 'P139' expense_type, 56000 budget
    from dual
    Desired output



    ENTITY EXPENSE_TYPE DIFFERENCE
    ------ ------------ ----------
    801040 2186 1000
    801040 3001-1000
    801040 P135-43000
    801040 P139 56000

    5 selected lines.



    Code current to achieve this, is there a better way?
    select original.entity
    ,      original.expense_type
    ,       (nvl(revised.budget,0) - original.budget) as difference
    from   original
    ,      revised
    where  original.entity = revised.entity(+)
    and    original.expense_type = revised.expense_type(+)
    and   (nvl(revised.budget,0) - original.budget) != 0
    union all
    select  revised.entity
    ,       revised.expense_type
    ,       revised.budget as difference
    from   revised
    where  not exists
    (select 'x'
    from   original
    where  original.entity = revised.entity
    and    original.expense_type = revised.expense_type)
    and    revised.budget != 0
    Thanks a lot for your comments,.


    Robert.

    Published by: Robert Angel on January 17, 2012 03:31 to change is not equal to! = - Thanks for the heads up
    SQL> with original
      2  as
      3  (
      4    select '801040' entity, '2186' expense_type, 234000 budget
      5    from dual
      6    union all
      7    select '801040' entity, '3001' expense_type, 1000 budget
      8    from dual
      9    union all
     10    select '801040' entity, 'P132' expense_type, 34000 budget
     11    from dual
     12    union all
     13    select '801040' entity, 'P135' expense_type, 43000 budget
     14    from dual
     15  )
     16  , revised
     17  as
     18  (
     19    select '801040' entity, '2186' expense_type, 235000 budget
     20    from dual
     21    union all
     22    select '801040' entity, 'P132' expense_type, 34000 budget
     23    from dual
     24    union all
     25    select '801040' entity, 'P139' expense_type, 56000 budget
     26    from dual
     27  )
     28  select *
     29    from (
     30          select nvl(o.entity, r.entity) entity,
     31                 nvl(o.expense_type, r.expense_type) expense_type,
     32                 nvl(r.budget,0) - nvl(o.budget,0) budget
     33            from original o
     34            full join revised r
     35              on o.entity = r.entity
     36             and o.expense_type = r.expense_type
     37         )
     38   where budget <> 0
     39  /
    
    ENTITY EXPE     BUDGET
    ------ ---- ----------
    801040 2186       1000
    801040 P135     -43000
    801040 3001      -1000
    801040 P139      56000
    
    SQL>
    
  • What is the difference between a table and a subform?

    What is the difference between a table and a subform in LC forms? Please post your answers about the merits and demerits of using subforms instead of tables.

    Hello

    a table is simply a set of subforms with a particular role.

    It is easier to handle the tables if they must be dynamic (add or remove lines, show or hide lines when page breaks appear etc..).

    And Designers UI has some dialogue prepared in the object palette to simplify the settings of the tables.

    For subforms, dialog boxes are more frequent, so you have yourself a little more script.

    But at least you can do everything with subforms as you can do with tables.

    The only one who is not very good with tables we work when you wrap arrays in other tables.

  • difference between the external and UTL_File utility table

    can someone clearly explain me what is the difference between the external and UTL_File utility table? and what case to use utl_file and external table?



    Thanks in advance.

    Hello
    To get a clear idea on the check of the external table link below

    http://www.orafaq.com/node/848

Maybe you are looking for

  • HP ProBook 4540 s: drivers AMD HD 7650 M/ProBook 4540 s

    Hello I'm trying to update my drivers graphic while I have drivers supporting OpenGL 3.3 or greater. According to some sites, I found that my HD 7650 M supports OpenGL 4.3. My Intel HD 3000 should also support OpenGL 3.3 +. The reason I need it is to

  • How can I remove 'Bar' of a document?

    I crossed out through my entire document How it go down. I can not find a sign for him

  • Windows xp hung up on the loading screen

    I have a gateway LT2016U and windows is suspended upward at the loading screen. the status bar continues to go, but the light of the hard drive on the computer is turned off. When I go to the safe made it stops at the line multi (0) disk (0) rdisk (0

  • Code 32

    Trying to install a HP printer. Get the code 32 message that a driver for this device has been disable and another driver is used. Have uninstalled and reinstalled the USB drivers, but it does not solve the problem.

  • The printer Officejet Pro Premium N911n 8600 performs the selection automatic tray?

    I have a printer Officejet Pro N911n, CN577A Pemium 8600 to two trays. My operating system is Win8, 64-bit, there is no error message, no change in System. The HP Officejet Pro 8600 e - all-in-One series User Guide indicates that by default, support