How to compare the names and types columns of two tables?

Assume I have two tables aaa and bbb
How do I compare the columnnames and types of the two columns?
It should not matter if one of them has e.g. an additional index.
Furthermore it does not matter if the rows/row values differ.
Peter

SQL> desc emp
Nome                   Nullo?   Tipo
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> desc emp2
Nome                   Nullo?   Tipo
EMPNO                  NOT NULL NUMBER(4)
ENAME                           VARCHAR2(10)
MGR                             VARCHAR2(10)
HIREDATE                        DATE
SAL                             NUMBER(7,2)
COMM                            NUMBER(7,2)
DEPTNO                          NUMBER(2)
NEWCOL                          NUMBER
SQL> with t1 as
  2  (select column_name, data_type from user_tab_columns where table_name='EMP'),
  3  t2 as
  4  (select column_name, data_type from user_tab_columns where table_name='EMP2')
  5  Select a.column_name, a.data_type, b.column_name, b.data_type
  6  from t1 a full outer join t2 b on a.column_name=b.column_name;
COLUMN_NAME                    DATA_TYPE                      COLUMN_NAME                    DATA_TYPE
EMPNO                          NUMBER                         EMPNO                          NUMBER
ENAME                          VARCHAR2                       ENAME                          VARCHAR2
                                                              NEWCOL                         NUMBER
MGR                            NUMBER                         MGR                            VARCHAR2
HIREDATE                       DATE                           HIREDATE                       DATE
SAL                            NUMBER                         SAL                            NUMBER
COMM                           NUMBER                         COMM                           NUMBER
DEPTNO                         NUMBER                         DEPTNO                         NUMBER
JOB                            VARCHAR2
Selezionate 9 righe.Max
http://oracleitalia.wordpress.com
Edited by: Massimo Ruocchio on Feb 21, 2010 1:27 AM
Changed query.

Similar Messages

  • How to change the name and description of a wim using DISM

    With Imagex we could update the name and description of the wim with on easy command:
    imagex /info img_file [img_number or
    img_name] [new_name] [new_desc]
    e.g.
    imagex /info Win7Combined.WIM 1 "Win7(x86)" "Windows 7 x86"
    Since the ImageX tool is deprecated in Windows 8 and has been replaced with DISM, can someone explain how to update the name and description with one easy command using DISM like we could with Imagex?

    It looks like this person had the same issue. Have you seen this
    link
    It talks about exporting an Index into a new WIM. Which, in a way, would be renaming it. It's really recreating it and you have to give it a name. But it seems to work.
    Dustin Estes - MCP | www.dustinestes.com

  • How to change the font and type in the front panel

    Can you tell me how to change the font and type in the front panel if i want to make it looks more beautiful.
    1110340040

    Hi there,
    You can change the font size and type as shown below:
    - Ee Lim -
    See that button on the left side of this post...
    If you feel my post is helpful, all you need is just (at most) 2 seconds to click that button, to show your appreciation. Thank you~~

  • How to change the Name and/or Alias of a Public Folder Mailbox in Exchange 2013

    So when I migrated our servers from 2010 to 2013. I did not plan well and ended up with this.
    Name                      Alias
    Mailbox1                  PF1
    Mailbox2                  Mailbox2
    Mailbox3                  Mailbox3
    As you can see the first mailbox is named PF1. I want to be able to change both the name and the alias, but have failed to find mechanism for doing so in ecp or powershell. Any assistance is greatly appreciated. I would also like to change the email address
    for these as right now they are [email protected], [email protected], [email protected]
    Thank you very much

    Set-Mailbox -Identity Mailbox1 -PublicFolder -Name NewName1 -Alias NewName1 -PrimarySMTPAddress [email protected]
    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

  • How to compare index names and columns from different user?

    I am using below query to compare two indexes from 2 different users but even though index name and columns are same... result shows me they are different.. what I am doing wrong? Thanks
    WITH t AS
            (SELECT COUNT (DISTINCT index_owner || index_name || indexed_cols)
                       cnt
               FROM (  SELECT index_owner,
                              index_name,
                              listagg (column_name, ',')
                                 WITHIN GROUP (ORDER BY column_position)
                                 indexed_cols
                         FROM dba_ind_columns
                        WHERE index_name='XPKTBL_A'
                     GROUP BY index_owner, index_name))
    SELECT CASE
              WHEN cnt > 1 THEN 'Indexes are different'
              WHEN cnt = 0 THEN 'Indexes dont exist'
              WHEN cnt > 1 THEN 'Indexes are identical'
           END
              commnt
      FROM t
    Result:
    Indexes are different
    but Actually if you check below they are same After when I run this query:
    SELECT index_owner,
             index_name,
             listagg (column_name, ',') WITHIN GROUP (ORDER BY column_position)
                indexed_cols
        FROM dba_ind_columns
       WHERE index_name='XPKTBL_A'
    GROUP BY index_owner, index_name;
    Result:
    Index_owner
    Index_name
    Index_cols
    USER1
    XPKTBL_A
    FIELD_A1
    USER2
    XPKTBL_A
    FIELD_A1

    Hi,
    Erhan_toronto wrote:
    I am using below query to compare two indexes from 2 different users but even though index name and columns are same... result shows me they are different.. what I am doing wrong? Thanks
    WITH t AS
            (SELECT COUNT (DISTINCT index_owner || index_name || indexed_cols)
    So index_owner is 'USER1' in one case, and 'USER2' in the other; right?
    A string that starts with 'USER1' will be distinct from a string that starts with 'USER2', no matter what the rest of the string contains.  Maybe you don't want to compare the owners, or maybe you meant to use some other column (such as table_name) instead of index_owner).
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE, CREATE INDEX and CONNECT statements), and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • How to get the name and value of an attribute on a node/element that is not a child

    Hello,
    Can someone shed some wisdom on how I can compare 2 xml nodes for differences.
    My main challenge is I need to use the attributes/values of 'ProductDescription' and 'Features' as 'key' to identify the same node in
    another doc with the same layout, but different content.
    I am having trouble getting the name of the attribute on the node, 'ProductDescription' and 'Features'.  I can only seem to get the node names, but not the attributes on the node.  I need the name, because it can be different from doc to doc, so
    I can't hardcode this.
    Can someone please help with how to retrieve an attribute name/value on a node that is not a child.  Here's an example of what
    my xml looks like:
    DECLARE
    @myDoc1 xml
    ,@mydoc2 xml
    DECLARE
    @ProdID int
    SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
    <Features  featureID  = "1" featureName = "body">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    <features featureID = "2" featureName = "seat">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    </ProductDescription>
    SET @myDoc2 ='<ProductDescription ProductID="1" ProductName="Road Bike">
    <Features  featureID  = "1" featureName = "body">
      <Warranty>2 year parts and labor</Warranty>
      <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    <features featureID = "2" featureName = "wheel">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    </ProductDescription>
    I need to compare the attributes of 'ProductDescription' and 'Features' from @mydoc1 against @mydoc2 to see if they are the same based on those 2 nodes first.  If they are, then i want to show the difference in the child elements. 
    This will eventually be an outer join to give me the differences betw the 2 docs based on those key values (node attributes).
    I used node('//*') for the path, and value('local-name(../.)', 'varchar(50)') as element
    ,value('.[not(@xsi:nil = "true")]','VARCHAR(255)') AS new_value
    ...etc...
    but that only gives me the node names, and the child elements.  It does not give me back the attribute names and values from the node itself.
    Thanks in advance for your help.
    cee

    Are you looking for something like this:
    DECLARE @myDoc1 xml
    SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
    <Features  featureID  = "1" featureName = "body">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    <Features featureID = "2" featureName = "seat">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    </ProductDescription>'
    SELECT T.c.value('local-name(.)', 'nvarchar(50)') AS name,
           T.c.value('.', 'nvarchar(50)')  AS value
    FROM   @myDoc1.nodes('ProductDescription/@*') AS T(c)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to determine the name or type of a control in a existed VI?

    I got a couple of VIs other engineers created before. There are a couple of controls I can not tell the type or name of that control.
    I used LabVIEW ctrl-H to try to figure out what control was used but failed. I also tried to use "Edit\Customize Control" to determine that control, still could not find it.
    Please advise how can I figure out what kind of controls were used in some existed VI. Thanks,
    RY

    The name of the control is its label. It may have an empty label, meaning no name. It's also possible its label is invisible. Right click it and go to Visible Items to find out.
    As for the type, the color and shape of the icon is usually the best way to tell.
    Right click the diagram terminal of the control and select View as Icon. This might help you. If it doesn't, I suggest you post the 2 controls in an empty VI, and I'm sure someone can figure it out.
    Try to take over the world!

  • How to make the name of a column apear as many times as the column on page

    Hi,
    This is what i want to do:
    I have a basic report looking like this:
    <Column name>
    value 1
    value 2
    value 3
    value n
    Since the column is small it can fit in a page more then one time. I know how to make it print more then once: i switch the repeating frame to print down and across and i modify the frame that contains it so the horizontal elasticity is variable.
    After these changes my report looks like this:
    <Column name>
    value 1-----------------------value n+1-----------------------value m+1
    value 2-----------------------value n+2-----------------------value m+2
    value 3-----------------------value n+3-----------------------...
    value n-----------------------value m
    What i want is my report to look like this:
    <Column name>-------<Column name>------------<Column name>
    value 1-----------------------value n+1-----------------------value m+1
    value 2-----------------------value n+2-----------------------value m+2
    value 3-----------------------value n+3-----------------------...
    value n-----------------------value m
    Would welcome any advice on how to achieve this please.
    Thank you.

    Hi,
    I will suggest a solution which may appear not simple. I do not know. Il did use this method, because a Government pre-printed tax form can print six values (in colum way) each page and it was not just esthetique question.
    1. Seams that you can know in advance the max number of column according to the width of the page and the length of the column.
    2. You can assume that you have x column at max by ligne
    3. Transforms your N rows in a table of M rows, each one with x columns : you will have N/x + N mod x
    4. I did this transformation using PL/SQL piplined function to transform rows to columns (by x)
    5. You base your report on the Pipelined function using select ... from Table (fnc_....) syntaxe
    6. make your vertical elasticity to variable and horizontal to fixed
    7. Put six labels on the top of your repeating frame (within a normal frame)
    I agree, it's not the solution if the requirment is just esthetic.
    Hope it helps.
    Mohamed Dadi

  • How to get the name and the path of the font used in photoshop (not textItem.font)

    I'm trying to get the real name of the font and the path, is there a "easy" way to do it ?
    i need to get the font file (*.ttf or *.otf) and copy to the same directory as the psd file, that's why textItem.font doen't work for me.
    thanks in advance

    You could try this as it looks as if you are using Windows.
    Run the VBS script to create a fontlist file on the desktop.
    Then run the javaScript on the PSD document.
    It should copy the fonts to the same folder as the document, it will also create a text file with a list of fonts.
    It didn't find all the fonts in my test psd maybe because it wasn't in the windows/font folder?
    VBS.
    Set wshShell = WScript.CreateObject("WScript.Shell")
    Set wshSysEnv = wshShell.Environment("PROCESS")
    sMyFile = "c:" & wshSysEnv("HOMEPATH") & "\Desktop\Fontlist.txt"
    Dim objFileSystem, objOutputFile
    Dim strOutputFile
    Set objFileSystem = CreateObject("Scripting.fileSystemObject")
    Set objOutputFile = objFileSystem.CreateTextFile(sMyFile, TRUE)
    Dim str
    Const HKEY_LOCAL_MACHINE = &H80000002
    strComputer = "."
    Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
    strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\Fonts"
    objReg.EnumValues HKEY_LOCAL_MACHINE, _
    strKeyPath,arrEntryNames,arrEntryZZZ
    For Each entry in arrEntryNames
    str = wshshell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Fonts\" & entry)
           objOutputFile.WriteLine(entry & "," & str)
    Next
    objOutputFile.Close
    javaScript.
    #target photoshop;
    app.bringToFront();
    main();
    function main(){
    if(!documents.length) return;
    try{
    var Path = activeDocument.path;
    }catch(e){
        alert("This document needs to be saved before running this script!");
        return;
    var FontFile = File(Folder.desktop + "/FontList.txt");
    if(!FontFile.exists){
        alert("You need to run the vbs script first to create the FontList file!");
        return;
    var FontList = new Array();
        FontFile.open('r') ;
    while(!FontFile.eof){  
       strInputLine =FontFile.readln();
       if (strInputLine.length > 3) inputArray  = strInputLine.split(",");
       if(inputArray.length == 2) FontList.push([[inputArray[0]],[inputArray[1]]]);
    FontFile.close();
    var PSDtextLayers = getNamesPlusIDs();
    PSDtextLayers = UniqueSortedList(PSDtextLayers);
    for(var a in PSDtextLayers){
        for(var f in FontList){
             var rex = new RegExp;
             rex = PSDtextLayers[a].toString();
            if(FontList[f][1].toString().match(rex,"i")){
                var From = new File("/c/windows/fonts/" + FontList[f][1].toString());
                var To = new File(Path + "/"+  FontList[f][1].toString());
                From.copy(To);
                break;
    var rFonts = new File(Path + "/required Fonts.txt");
    rFonts.open('w');
    rFonts.write(PSDtextLayers.join('\n'));
    rFonts.close();
    function UniqueSortedList(ArrayName){
    var unduped = new Object;
    for (var i = 0; i < ArrayName.length; i++) {  
    unduped[ArrayName[i]] = ArrayName[i];
    var uniques = new Array;for (var k in unduped) {
       uniques.push(unduped[k]);}
    return uniques;
    function getNamesPlusIDs(){
       var ref = new ActionReference();
       ref.putProperty( charIDToTypeID( "Prpr" ), charIDToTypeID( 'NmbL' ));
       ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
       var count = executeActionGet(ref).getInteger(charIDToTypeID('NmbL')) +1;
       var Names=[];
    try{
        activeDocument.backgroundLayer;
    var i = 0; }catch(e){ var i = 1; };
       for(i;i<count;i++){
           if(i == 0) continue;
            ref = new ActionReference();
            ref.putIndex( charIDToTypeID( 'Lyr ' ), i );
            var desc = executeActionGet(ref);
            var layerName = desc.getString(charIDToTypeID( 'Nm  ' ));
            var Id = desc.getInteger(stringIDToTypeID( 'layerID' ));
            if(layerName.match(/^<\/Layer group/) ) continue;
            if (desc.hasKey(stringIDToTypeID('textKey'))){
                desc = desc.getObjectValue(stringIDToTypeID('textKey'));
                desc = desc.getList(stringIDToTypeID('textStyleRange')).getObjectValue(0).getObjectValue(stringIDToTypeID('textStyle'));
                var postScriptName = desc.getString( stringIDToTypeID('fontPostScriptName'));     
    Names.push(postScriptName);
    return Names;

  • How to delete the date and time column from a waveform spreasheet file

    after acquiring a signal through the DAQ i am writing it in a spreadsheet. but for further post processing of the data the date and the time column are unneccessary. is there some way to format the file in labview so that those columns are removed. the DAQmx read  gives as output a 1 d array. so i could not find a way to select only the Y column

    If you are getting a 1D array from the DAQmx Read, then you don't have any date/time information to write and if you are using the Write to Spreadsheet File, there should be no way you can have the date/time information in the file. Whatever you hjave programed to put the date/time into the file, don't do it.
    p.s. You may not think you need timing information but for a lot of post-processing, it is essential to have. If it's in the file, you can always ignore when you read it and if you later find out it's necessary, it will already be there.

  • How to compare array of String with column of a table

    Hi,
    i have a array of string(say array is of length 1000). I want to
    compare those string in array with one table column
            - whether that table column has a string
                            if yes
                                            do nothing.
                            if no
                                            then insert that string into table.
            - whether table has obsolete row i.e, the one present in table and
    not in array
                            then delete that row.
    How do i go about this, because i see, it is not feasible to loop
    through array and search table to find new string OR loop through each
    row from table to find some obsolete row
    How can i accomplish this task more feasibly(without running query for
    each string, for comparission)? Is there any way to find this kind of
    problem. I would have been easy if i had to compare two tables(with
    UNION and INTERSECT), but it is not the case.
    thanks,
    kath.

    I'm not sure, whether I understand your problem correctly. Only two comments:
    - if both arrays are sorted, all can be done running exactly once simultaneously through both arrays.
    - if the column is marked as UNIQUE, all column strings will be different. I.e. you cannot insert the same string a second time.
    Regards  Thomas

  • Flat file having multiple header lines , how to separate the same and pushit into my intrnal table

    Hi Guys,
                    I got an issue , My flat file having multiple header lines
    TPS27RPR  MOME                                      THRIFT (SAVING) PLAN SYSTEM                                           Page    2
    09:54 05 JAN 2014                          List of Contributors w/Company Contributions                           Phase DAY Unit TRE
    Company No: xxxxxxxx - xxxxxxxxxxxxx.
                                                                            Employee/       Employee/
    Employee Full Name/                                                       Company         Company                        Allocation
    Number  ID Number                           PS  PN  End Date        Contribution          Profit        Total Balance   Percentage
    some lines of data and again
    TPS27RPR  MOME                                      THRIFT (SAVING) PLAN SYSTEM                                           Page    2
    09:54 05 JAN 2014                          List of Contributors w/Company Contributions                           Phase DAY Unit TRE
    Company No: xxxxxxxx - xxxxxxxxxxxxx.
                                                                            Employee/       Employee/
    Employee Full Name/                                                       Company         Company                        Allocation
    Number  ID Number                           PS  PN  End Date        Contribution          Profit        Total Balance   Percentage
    in this case how could I separate the header lines from the flat file and update the details to my internal table.
    kindly help me on this issue.
    Thanks and regards,
    M.S.Amirtharajvijay.

    Hi Amirthraj,
    If the flat file is static (if the content within it is same for all) then use the offset concept. First get the contents of the flat file into an internal table and later find the field that has to be in final internal table within the line, calculate the offset for the line and get the value into an workarea. Finally modify/append the work area into an internal table. Also wait for other experts answers for any other hassle free way to achieve the requirement.
    With Regards,
    Giriesh M

  • How to compare the first and last characters of strings?

    lets say we have a name column with values;
    c1
    Antu Anamentu
    Steven Smith
    Since A=A and U=U for the first value we need a TRUE and FALSE for the second value SQL. Is this possible to do with REGEXP functions on 10gR2.
    Thank you.

    Hi Frank,
    Just minor correction: REGEXP_LIKE (Name1, '^(.).*(.) \1.*\2$') ;
    Explanation: ^(.) =>^ specifies the next char is first char
                                . dot specifies single character
                               ()  defines group which can be backrferenced
                       .* => Any number of characters as we want only first and last character
                      (.)  => (.)space The space signifies that we want to remember last char of first word or char before space
                       \1 => It recalls first group which we saved for backreference using (.)
                       .* => Any number of chars
                      \2 =>  It recalls first group which we saved for backreference using (.)
                       $ => It specifies the char before this is last charHope it clarifies :)
    SQL> WITH t AS
    SELECT 'Antu Anamentu' Name1 FROM DUAL UNION ALL
    SELECT 'Steven Smith' Name1 FROM DUAL
    SELECT Name1
    FROM t
    WHERE REGEXP_LIKE (Name1, '^(.).*(.) \1.*\2$')  ;
    NAME1
    Antu Anamentu

  • How to save user name and system date in a table

    I have a form that allow users to enter some information...
    I want to save user name in one of the columns and system date in another column by default when the user submit the form to save data...
    Please advice...
    Thanks

    Hi talbo,
    The most reliable method is to use a before-insert trigger on your table. This way the columns will be set properly no matter how rows are inserted (via your app or any other means). Given your user name column is called "CREATE_USER" and your date column is called "CREATE_DATE" for example - include these lines in a before-insert trigger:
    :NEW.CREATE_USER := NVL(V('APP_USER'), USER);
    SELECT SYSDATE INTO :NEW.CREATE_DATE FROM DUAL;The NVL(V('APP_USER'), USER) will set CREATE_USER to the current ApEx application user if the row is created from within the application, or to the current database user if the row is created outside the application.
    Hope this helps,
    John
    If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well.

  • How to get the sum of  a column in a table layout region

    i have page table layout region and i have many rows in that ...i have a column say xyz now i want the sum of all xyz in all rows ...is that possible ..if it is how..????
    please help me out in this issues...so that i can proceed further with my work..im stuck otu here....if the solution r there in the devguide please tell me where it is ..i mean under which section...bcoz it 1400page document...

    If you are mentioning about table/advanced table region you can enable totalling in those regions. Please check the Table / Advanced Table section as appropriate in Chapter 4 of the dev guide.
    If it is not a table / advancedTable then you will have to programmatically total the column value and display it in the appropriate cell.

Maybe you are looking for

  • "An error occurred while installing Adobe AIR"

    I am running Vista Home Premium SP1, and I keep getting the following error while trying to reinstall Air. After the install, I get a dialog box telling me Air installed successfully. When I click OK, I get a second box telling me: "An error occurred

  • Adobe Acrobat Standard XI print issue

    When opening a PDF in internet explorer, adobe acrobat won't read pre chosen print driver settings. When using acrobat stand alone, not in internet explorer, it does read the print settings. Specifically the issue is you set up print driver as single

  • LSMW : Urgent SO - DI - Material Configuration Prob

    Hello all, [Direct Input Approach] In my quest for uploading Legacy system SO through LSMW . I have reached at the stage where I am able to create Sales Order successfully but only 1 problem is.. Our client has customization done where by selecting a

  • Icloud setup not working on my PC

    I get the following error message your setup couldnt be started because of an unexpected error Ive read online that this is an error that is known and theyre working on it. Anyone got an update on it?

  • Issue using ADSI in powershell to load users from another domain into a group

    I am trying to load users into a domain local security group from another domain using ADSI and powershell. For users who have an existing foreign security principal I can load that without issue, but the users who do not have a foreign security prin