How to fetch table_names along   with the result

Hi all,
I want to find strucural differences between two kinds of tables .
One is original table and another one is archival table .
All archival table names will have different name from original tables.
Please tell me how to get table name in the below query..
((SELECT column_name, data_type, data_length, data_precision, nullable
    FROM user_tab_columns
   WHERE table_name LIKE '%X271%HIST'
         AND table_name <> 'X271_ELIG_RSPNS_TABLE')
MINUS
(SELECT column_name, data_type, data_length, data_precision, nullable
    FROM user_tab_columns
   WHERE table_name LIKE '%X271%'
     AND table_name NOT LIKE '%WS'
     AND table_name NOT LIKE '%_HIST'
     AND table_name <> 'X271_ELIG_RSPNS_TABLE')
UNION ALL
((SELECT column_name, data_type, data_length, data_precision, nullable
     FROM user_tab_columns
    WHERE table_name LIKE '%X271%'
      AND table_name NOT LIKE '%WS'
      AND table_name NOT LIKE '%_HIST'
      AND table_name <> 'X271_ELIG_RSPNS_TABLE')
  MINUS
  (SELECT column_name, data_type, data_length, data_precision, nullable
     FROM user_tab_columns
    WHERE table_name LIKE '%X271%HIST'
      AND table_name <> 'X271_ELIG_RSPNS_TABLE')));Thanks,
P Prakash
Edited by: prakash on Sep 5, 2011 5:49 AM

You'll have to JOIN instead of MINUS:
SELECT * FROM
  (SELECT table_name, column_name, data_type, data_length, data_precision, nullable WHERE table_name = 'orig') orig
  INNER JOIN
  (SELECT table_name, column_name, data_type, data_length, data_precision, nullable WHERE table_name != 'orig') other
  USING(table_name, column_name)
WHERE
  orig.data_type != other.data_type OR
  orig.data_length != other.data_length OR
...This doesnt show tables whose column names have changed, for that you'll have to use a full outer join:
SELECT * FROM
  (SELECT table_name, column_name WHERE table_name = 'orig') orig
  INNER JOIN
  (SELECT table_name, column_name WHERE table_name != 'orig') other
  ON(orig.table_name = other.table_name AND orig.column_name = other.column_name)
WHERE
  orig.column_name IS NULL or
  other.column_name IS NULLYou could maybe combine these.. i know my oracle 9.2 would fall over if I tried so i didnt :)

Similar Messages

  • How to fetch count along with other details

    I am trying to write a simple Select query that will return a list of
    Employee Names from EMPLOYEE_TABLE,and in the second colum a count of the
    number of entries for each employee in EMPLOYEE_ATTENDANCE table.
    Can anybody suggest how I could do this?
    For Example :
    I have two tables EMPLOYEE_TABLE and EMPLOYEE_ATTENDENCE .
    EMPLOYEE_TABLE:
    emp_number emp_name
    1 A
    2 B
    3 C
    4 D
    EMPLOYEE_ATTENDENCE :
    emp_number emp_time
    1 8.00
    1 8.00
    1 8.00
    4 8.00
    4 9.00
    4
    4
    4
    3
    3
    3
    2
    Now ,my requirement is I want to fetch the list of employees with emp_name and the number of days
    the employee has come(i.e number of entries in the EMPLOYEE_ATTENDENCE table ).
    Some like :
    A 3
    B 1
    C 3
    D 5

    Just you have to join them and group it.
    SQL> with emp
      2  as
      3  (
      4     select 1 no, 'A' name from dual
      5     union all
      6     select 2, 'B' from dual
      7     union all
      8     select 3, 'C' from dual
      9     union all
    10     select 4, 'D' from dual
    11  ),
    12  emp_att
    13  as
    14  (
    15     select 1 no, 8.00 tm from dual
    16     union all
    17     select 1, 8.00 from dual
    18     union all
    19     select 1, 8.00 from dual
    20     union all
    21     select 4, 8.00 from dual
    22     union all
    23     select 4, 9.00 from dual
    24     union all
    25     select 4, 0 from dual
    26     union all
    27     select 4, 0 from dual
    28     union all
    29     select 4, 0 from dual
    30     union all
    31     select 3, 0 from dual
    32     union all
    33     select 3, 0 from dual
    34     union all
    35     select 3, 0 from dual
    36     union all
    37     select 2, 0 from dual
    38  )
    39  select name,count(name)
    40    from emp e, emp_att a
    41   where e.no = a.no
    42  group by name
    43  order by name
    44  /
    N COUNT(NAME)
    A           3
    B           1
    C           3
    D           5

  • How to display playlist along with the music library

    I can't seem to find out how to get all of my playlist displayed along side of my music library just like ITUNES used to be in the older version.

    View Menu > Show Sidbar

  • How does one continue to use Mail on the early MacBook Pro, Model 1,1, that is not upgradable to Lion?  I have been running iCloud on my iPhone (OS5) and iMac (Lion) along with the MacBook Pro (OS Version 10.6.8)

    How does one continue to use Mail on the early MacBook Pro, Model 1,1, that is not upgradable to Lion?  I have been running iCloud on my iPhone (OS5) and iMac (Lion) along with the MacBook Pro (OS Version 10.6.8) since November until now.  Mail will no longer download on the MacBook Pro and keeps asking for my password.

    Mail should still be usable with your machine - but you'll need to update the settings to conform to the requirements of your system. Check with your ISP (like ATT, etc.) for the settings that will work with your Mail. Once you've updated this, you should be able to email like before.
    For example, my ISP required that I go to Mail Preferences/Accounts and make sure the details conform to your email settings.
    I have no idea of what your ISP is or what the settings might be, but this is likely the source of the problem.

  • I forgot my password along with the answers to my security questions. So I try sending an E-Mail to myself but the E-Mail I am sending it to isn't even mine, nor the one I have registered. How can I change the E-Mail or something?

    I forgot my password along with the answers to my security questions. So I try sending an E-Mail to myself but the E-Mail I am sending it to isn't even mine, nor the one I have registered. How can I change the E-Mail or something?

    Security questions:
    https://discussions.apple.com/thread/4533485?tstart=0

  • How to print the top of page part along with the ALV list and generate PDF

    HI all,
             I have created one ALV by using oops concept .
             and also am able to get the top of page where I have One standard logo on the right hand side
             and some details on the left side .
               Now my requirement is to while printing the list the logo and other top of page details should appear
               In the PDF output but currently while am pressing the print preview button only the alv data is coming
              am already using the method
        handle_top_of_page
          FOR EVENT print_top_of_page
                 OF cl_gui_alv_grid,
    may be am missing something ... How to get the top of page along with the logo printed ?

    Hi  Surya,
    After generating the grid display  click on print button,
    a spool number is generated. capture the spool number and convert it to pdf using the fm:
    CONVERT_ABAPSPOOLJOB_2_PDF  and save the file
    Hope this will solve your problem.
    Regards,
    R K.

  • How to get Header data into multiple times along with the Line Items

    Dear All,
      I have problem while mapping the Header data and line item data to the flat file structure, Header data have to repeat along with the Line item data in the flatfile.
    Details is below.
    Example
    Header record is one
    E1EDK01
    E1EDKA1
    Line items are two
    E1EDP01
    E1EDP01
    I want in the flat file two records having duplicate data in the fields which is belongs to header data
    Like :
    Record #  partner data     Line item data
    Record 1 : WE name1 city   00010 materialname1 156
    Record 2 : WE name1 city   00020 materialname2 198
    ( WE name1 city - data is same in the record 1)
    For this what I did is I mapped the node E1EDP01 to the flat file message type node then I got all the line item data and first record is with header data but not in the second record.
    I tried all node functions but no result because Idoc itself header data exists one record, I am not able to copy.
    If any one knows , please give solution.
    It is great help to me.
    Thanks in Advance.
    Ramarao

    Dear Ramarao,
    This will help you,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3b
    No Documentation for Mapping Function useOneAsMany (Mapping Problem)
    /people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
    /people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
    /people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
    Thanks & Regards
    Agasthuri Doss

  • When I search for something, firefox opens a new tab with the results. How can I change the settings to where it will all stay in the same tab?

    When I search something Firefox automatically opens a new tab with the results of this search. How do I change the settings to where the results will appear in the same tab as where I conducted the search?

    Whether to open search results in new window most often is a setting of the search engine you are using.

  • How can I add the date at the top of the screen along with the day and time display?

    Hello,
    How can I add the date at the top of the screen along with the day and time display?
    Thanks so much!

    Open System Preferences>Date & Time:
    Ciao.

  • Getting the parenet id along with the child ids in hierarchy query results

    create table test_test2 (do_id_tp varchar2(32),do_id number ,do_up_tp varchar2(32),do_up_id number)
    insert into test_test2 values('A_S',100170,'A_S',100001);
    insert into test_test2 values('A_S',1001054,'A_S',100001);
    insert into test_test2 values('A_S',1001055,'A_S',100001);
    insert into test_test2 values('A_S',1001053,'A_S',100001);
    insert into test_test2 values('A_S',1001056,'A_S',100001);
    insert into test_test2 values('A_S',1001051,'A_S',100001);
    insert into test_test2 values('A_S',1001052,'A_S',100001);
    insert into test_test2 values('A_S',100358,'A_S',100170);
    insert into test_test2 values('A_S',100359,'A_S',100170);
    insert into test_test2 values('A_S',100441,'A_S',100170);
    insert into test_test2 values('A_S',1001047,'A_S',100441);
    9/code]
    Upon executing the following query , i'm getting the childs of 100001 and the childs of childs of 100001 etc..
    That if fine .But in the output i'm not getting the parent id i.e; 100001 (which is in the where condition)
    How to get the parenet id along with the childs id.( without writing the UNION select 100001 from dual)SELECT do_id
    FROM (
    SELECT d.do_id, d.do_up_id
    FROM test_test2 d
    WHERE d.do_up_tp = 'A_S' ) m
    CONNECT BY NOCYCLE PRIOR m.do_id = m.do_up_id
    START WITH m.do_up_id =100001
    Edited by: smile on Jan 12, 2012 6:50 PM

    If you wish the root parent as a column in your select, you can use CONNECT_BY_ROOT:
    SELECT
    connect_by_root(do_up_id) root,
    do_up_id parent,
    do_id
    FROM (
       SELECT  d.do_id, d.do_up_id
       FROM test_test2 d
       WHERE    d.do_up_tp = 'A_S'
    ) m
    CONNECT BY NOCYCLE PRIOR m.do_id = m.do_up_id
    START WITH m.do_up_id =100001;But if you really wish an extra row in your output with 100001, then your problem is that you do not have a record in your data with do_id = 100001.
    Then you either need such a record in your data, or you need to create such a row with for example union all - something like this:
    SELECT
    do_id
    FROM (
       SELECT  d.do_id, d.do_up_id
       FROM test_test2 d
       WHERE    d.do_up_tp = 'A_S'
       UNION ALL
       SELECT 100001 do_id, NULL do_up_id
       FROM DUAL
    ) m
    CONNECT BY NOCYCLE PRIOR m.do_id = m.do_up_id
    START WITH m.do_up_id IS NULL;

  • Deleted cell number appears (along with the edited number) when sending a text.  How do I get rid of it?

    Deleted cell number appears (along with the edited number) when sending a text.  How do I get rid of it?

    It has nothing to do with iOS 6. It's always been that way. Given that it's been this way for so long, one assumes that Apple knows about it and has their own reasons for not changing it.
    Restore the phone as new, not from back up to delete the numbers. Or, wait until the cache gets overwritten.
    Best of luck.

  • I have Photoshop 12, installed online.  My computer crashed and was repaired, but Photoshop was not restored.  I see it in my products, along with the serial number/activation key, but no download is available.  How do I re-download my product?

    I have Photoshop 12, installed online.  My computer crashed and was repaired, but Photoshop was not restored.  I see it in my products, along with the serial number/activation key, but no download is available.  How do I re-download my product?

    Unfortunately, only Adobe customer service can assist you with your issue. These are user forums; you are not addressing Adobe here.
    Click on the link below, and after that click on "Still need Help? Contact us."
    Then on the next page, click Chat.
    There is also a phone option. 1 (800) 833-6687
    http://helpx.adobe.com/contact.html?step=PHXS_downloading-installing-setting-up_licensing- activation

  • When will I receive my I phone 6 case which i ordered along with the Iphone6 ?As per the website it says october . How long is the wait time for the Iphone 6 case?

    When will I receive my I phone 6 case which i ordered along with the I phone 6 ?As per the website it says October. How long is the wait time for the I phone 6 case?

    While we have no idea within this Community Forum how long you would have to wait for your iPhone 6 Case, I can tell you that there would not be a "general" answer of value.  Like any product that is available in different materials and colors, the inventory varies based on what you have specifically ordered.  For example, I visited an Apple Store on the day after the iPhone 6 became available and was interested in the "Midnight Blue" Leather"  Apple iPhone 6 Case.  The store had plenty of all the other colors, but that specific case and color had sold out that morning. 

  • I bought by mistake the 9.99$ creative suit along with the 19.99$ one. I need to cancel the first, how is it done?

    I bought by mistake the 9.99$ creative suit along with the 19.99$ one.
    I need to cancel the first and stick nwith the second, how is it done?

    Cancel the Cloud http://forums.adobe.com/thread/1439535?tstart=0 may help

  • How to make plant default on the line item along with the item category

    Hi All,
    I want to default Plant on the line item along with the item category.In order to meet the following scnario.
    1. I have two plants,first plant is maintained for the valuated item and the second plant is maintained for the non valuated item (Free Goods).
    Whenever user is entering an item in the sales order for which corresponding free goods item is maintained in the master record.System is proposing two lines items in the sales order.
    First line item is the main item which appears along with the Plant 1 which contains valuated items
    Second line item is for the Free of charge item which is being proposed from Plant 2, which contains the non valuated items.
    I want that the system should always propose Plant 1 with main item and Plant 2 with the Free of Charge item by default. (Along with the item category TAN and TANN)
    Rahul

    Delivering Plant is determined in the following order
    1. Customer material info record.
    2. Customer master
    3. Material master.
    Use one of them an default your plant.
    I think in your case you can use the materila master which will give an item level plant different. The other two will default the plant at the header level.
    regards
    jude

Maybe you are looking for

  • Multiple Reconcilation Accounts

    Hi gurus I am getting one problem. As i am maintained Multiple alternative reconcilation accounts to vendor/customer. Because at the invoice posting i want select suitable reconcilation account. But the Reconcilation account field was displed as non-

  • Problems with german umlauts when Migration from MS Access to Oracle

    When I make a Migration from MS Access 97 to Oracle 8.1.5, I have Problem with the germans characters (umlauts). The Oracle is using the rigth character Set for german characters. What can I do? Is it e problem from the MS Access ODBC Driver or the O

  • Calendar question on the 9530...

    Hello everyone. So this thread might be better in the newbie section, but since the storm is so different than the other BB's I figured here is a good place to start. I've had my storm since April 2009 and am just starting to use the calendar. I use

  • Unable to buy movies in Apple Store

    In the Dutch iTunes store I do mis the item 'Movies' So I`m not able to buy a movie to download it to my Iphone.

  • Headphone jack malfunctioning

    The headphone jack in my less than 3 month old iPhone 4s is malfunctioning. I can't play music thru my external speaker and it only makes noise for my alarms and incoming calls. I can hear music thru my headphones, but that cuts out within 3 mins. My