Howto INSERT new column in correct position

Currently I have a Table with 19 column, but it should have 20. I would like to insert after column 15, the new 16th column, so that it will be 20.
I know how to alter a table, but how do I tell it to insert it as the new 16th column ?
alter Table TABLE
add
COLUMN16 varchar2(10);
THanks!
TGIF

Again, it depends.
If you just want to fix your query
Create Table TABLE AS
Select column1, to_char(column2) column2, column3 from Table1
UNION
Select column1, column2, column3 from Table2;If you want to fix Table1
ALTER TABLE table1
  ADD( column2_varchar2 VARCHAR2(30) );
UPDATE table1
   SET column2_varchar2 = to_char( column2 );
ALTER TABLE table1
  DROP( column2 );
ALTER TABLE table1
  RENAME COLUMN column2_varchar2 TO column2Taking a step back, though, why are you creating a new table that is the result of unioning two other tables? Is this a one-time data model change? Or is this part of some ongoing process?
Justin

Similar Messages

  • How to add a new column to specific position

    Hi,
    How to add a new column to specified position in a existing table.
    I have using the oracle database 10g.
    This below code is not working in oracle 10 g
    example:
    ALTER TABLE EMPLOYEE ADD DEPT NUMBER FIRST:
    ALTER TABLE EMPLOYEE ADD DEPT NUMBER AFTER JOB:
    Please provide the correct syntax.

    Hi,
    When you add a column to the existing table, the column added i.e., for ex updatedon appers in the last. If you want the columns to be
    displayed in Specific order. Just give the column names in the SELECT.. statement.
    For your Information, But it is not good in Table design. Just to give something useful.
    If you want to add a column at a specified position,
    Rename the position column to the new column name
    For Ex: (OLD_COLUMN_NAME-Hiredate)
    ALTER TABLE EMP RENAME COLUMN OLD_COLUMN_NAME TO TEMP_HIREDATE;Add a New Column to Table
    ALTER TABLE EMP ADD LAST_DATE DATE;Then, Alter the Table to rename the new column that is added.
    ALTER TABLE EMP RENAME COLUMN LAST_DATE TO OLD_COLUMN_NAME;And, Rename TEMP_HIREDATE to your actual collumn.
    ALTER TABLE EMP RENAME COLUMN TEMP_HIREDATE TO LAST_DATE;In practise, this won't be a good approach but you can get something useful about renaming the
    column atleast.
    Thanks,
    Shankar

  • Option + arrow keys suddenly inserts new columns

    This happens frequently when I work in Numbers.
    When I shall edit text in a cell, option + > and option + < all of a sudden cease to work. Instead of jumping to next or previous word, a new column is inserted.
    I don't know what causes it. I haven't found another solution than closing the document and reopen it.
    Fred

    I always edit text directly in cells and option + arrow keys normally jump to next or previous word.
    Yes they are greyed out for me too.
    I just noticed that if I by mistake press Cmd + return (instead of option + return) when I want to edit, it causes option + arrow keys to insert new columns. I can revert to normal by placing the cursor in the formula bar and using option + arrows. After that option + arrow keys jump to next or previous word also when I edit directly in cells.
    Thanks for telling about using the formula bar. Now I don't have to close and reopen the document.

  • Problem while inserting new Column in JTable

    Hi,
    I am facing Problem while inserting new Column in JTable.
    I have a JTable with one inherited ColumnModel class.
    When I am adding the column and moving towards the corresponding location, it moves successfully.
    but if I am adding another column or making any changes to table column structure the table retains the defualtcolumn structure.
    please help me to solve this..
    Regards
    Ranjith.........

    Maybe this example will help:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=579527

  • Insert new Column in Reporting Cockpit (Portfolio Management)

    Dear colleagues;
    Any of you could change and insert a new column in Reporting Cockpit for BCV consult?
    I need to insert a new column with a formula (operation with more than two other column).
    How yo can activate this BCV Consult?
    Best regards.
    Mariano

    Dear Guru's;
    I have the solution.
    I solve this problem with the BRF Plus application.
    Watch this site --> Business Rule Framework plus [original link is broken]
    And go to the BCP Admin link in SAP PPM in Business Context Viewer -> Configuration center -> BCV Consult.
    Best regards.

  • How to add new column in specific position

    Say, a table has existing columns of A, B, D, and E.
    Now I want to add a new column C. But I want this column appear between B and D. I found that the newly added column always goes to the end of the table, i.e., A, B, D, E, C, instead of, A, B, C, D, E.
    How can I do it?

    scottjhn wrote:
    Say, a table has existing columns of A, B, D, and E.
    Now I want to add a new column C. But I want this column appear between B and D. I found that the newly added column always goes to the end of the table, i.e., A, B, D, E, C, instead of, A, B, C, D, E.That's right; new columns are always added at the end.
    Why is is so important to have the columns in a specific order? If the order is important, why aren't you specifying it in the SQL code that actually uses the table?
    How can I do it?When you add C, add columns called NEW_D and NEW_E as well, in that order, where NEW_D has the same data type as D, and NEW_E has the same data type as E. Then UPDATE the table to set NEW_D and NEW_E to be the same as D and E, drop the original D and E, and rename NEW_D and NEW_E to the original names, D and E.

  • Can't insert new row in last position in row set

    I am trying to programmatically insert a new row into the last slot of a View Object's default row set.
    I normally can do this:
    Row newRow = vo.createRow();
    // set stuff on the row
    vo.last();
    vo.next();
    vo.insert(newRow);and, voila, the row is in the last position.
    But on this particualr view object, when I do the above, the row is inserted in the first slot.
    There doesn't seem to be anything unusual about the View object. it is a child Vo in the data model, but that shouldn't matter.
    When I debug with vo.getCurrentRowSlot(), even after performing last(); next();, vo.getCurrentRowSlot() returns 0, never 3.
    Has anyone else run into this behavior and if so, any resolution or explanation?
    FYI, I was able to use the following workaround:
    Row lastRow = vo.last();
    if (lastRow != null){
        int indx = vo.getRangeIndexOf(lastRow) + 1;
        vo.insertRowAtRangeIndex(indx, newRow);
    } else {
       vo.insertRow(newRow);
    }   

    would this solve your problem
    http://kohlivikram.blogspot.com/2008/10/add-new-row-in-adf-table-on-button.html

  • Insert new column after get then XML

    Hello,
    I use Oracle 8i and SQL Utility. I want to do a query and after that, modify or insert the values of some elements.
    xmlgen.clearBindValues;
    xmlgen.setBindValue('vCity', vCity);
    xmlSQL := 'select name, depto from emp where city = :vCity';
    xmlString := xmlgen.getXML(xmlSQL);
    Now, I want to read each line and modify
    the name or depto values before create the
    XML file. How can I do this?
    Thanks,
    Arthur Rafael

    Again, it depends.
    If you just want to fix your query
    Create Table TABLE AS
    Select column1, to_char(column2) column2, column3 from Table1
    UNION
    Select column1, column2, column3 from Table2;If you want to fix Table1
    ALTER TABLE table1
      ADD( column2_varchar2 VARCHAR2(30) );
    UPDATE table1
       SET column2_varchar2 = to_char( column2 );
    ALTER TABLE table1
      DROP( column2 );
    ALTER TABLE table1
      RENAME COLUMN column2_varchar2 TO column2Taking a step back, though, why are you creating a new table that is the result of unioning two other tables? Is this a one-time data model change? Or is this part of some ongoing process?
    Justin

  • Inserting new columns based on the condition!

    Hi guys,
    I have a very simple query like the following… 
    SELECT table2.column_code2,
    table2.column_description2,
                 table2.column_code1,
                 table1.column_description1
    FROM database_001.table2 table1 LFET OUTER JOIN database_001.table2 table1 on (table2.column_code1 = table1.column_code1)
    From this query, its returning me a result set of something like below:
    column_code1       column_description1        column_code2                 column_description2
    RO1                              BOOK                              RL1            
                               PDF/ECOPY
    RO2                              PAPER                             RL2            
                            CONFERENCE
    RO5                            JOURNAL 
    RL11  OTHER
    Now, on the above query I want to insert three extra columns with the name (status, location and contact) where the results in the extra three columns would be based on the conditions I want to define in the query based on the above results…
    Something for example (sorry, I am not trying to write a condition: my question is how to write it), 
    if column_code1 = RO1 and column_description2  =  PDF/ECOPY on status column it should return a value ‘ONLINE’ & on location column it should return ‘WEB’ and on contact column it should write ‘BOB’.
    Also,
    if column_code1 = RO5 and column_description1 = JOURNAL on status column it should return a value ‘ON PRESS FOR PRINT’ & on location column it should return ‘S.R STREET, LONDON’ and on contact column it should write
    ‘SMITH’ like below result…so the final output should be the top four columns and the extra three columns…I hope someone can help me into this…thanks a lot…
    status                                            location                
                            contact
    ONLINE                                               WEB                          
                           BOB
    ON PRESS FOR PRINT                     S.R STREET, LONDON                           SMITH

    Hi artistdigital,
    you can use case statment for same in sql server. MSDN link - > http://technet.microsoft.com/en-us/library/ms181765.aspx
    Try code like this:
    SELECT table2.column_code2,
    table2.column_description2,
    table2.column_code1,
    table1.column_description1,
    case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'ONLINE'
    when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'ON PRESS FOR PRINT'
    end as [status],
    case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'WEB'
    when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'S.R STREET, LONDON'
    end as [Location],
    case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'BOB'
    when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'SMITH'
    end as [contact]
    FROM table2
    join table1
    on table2.column_code1 = table1.column_code1
    Regards Harsh

  • Insert new user column in pick and pack manager window

    Hi all,
    Exist a way to insert new column in pick and pack manager window?
    I try  by code too but i can´t. Is possible to do this?
    Thank you all again.
    Regards.

    Hi Aitor,
    Unfortunately, I don't think it is possible to add columns to this particular window. I had a requirement to do this a while back in SBO 2005A SP1 and I ended up designing my own pick and pack window.
    Kind Regards,
    Owen

  • Excel & ActiveX: Insert arbitrary columns from 2D array and create graph problems

    Hi there,
    I want to insert data from either a 1D or 2D array from LabView into Excel and create graphs.
    I used the information from the following example:
    http://www.ni.com/example/28934/en/
    and was able to create a new Excel file (I'm using Excel 2010), writing data from an 1D array to a column in excel by creating a while loop and using the first element of the array to write it to a specific cell. I use the counter of the loop to write to the next cell when the loop starts over and always delete the first value, which I write to the cell, from the array until it is empty.
    Now I also would like to write a 2D array - so the first column in Excel should be the first column from the array and so. Here I cannot use the loop counter directly as Excel only counts 1,2,... for the rows, but uses A,B,... to count columns. Also I do not know in advance how many columns my 2D array will contain, so creating a lookup table like (A means 1, B means 2,...) is not really an option (except there really is no other way). Is there a possibilty to convert numbers into letters or some way to 'explain' to the program that column 2 in the array means column B in Excel for example, or is there a way to insert new columns?
    I figured out how to add new Worksheets and as I also need to create a certain number of Worksheets and I know that on standard 3 sheets are present when creating the file, I use the 'add' methode to create every new worksheets before worksheet 3 - I could use the same methode to create new columns in Excel, but so far I didn't find a methode to do so. Or is there a way to enter the whole 2D array at once?
    Then I'd like to create a graph (in case of the 1D arrays a bar plot, when using 2D arrays a 3D plot) to view the data. I found this example:
    http://www.ni.com/newsletter/51339/en/
    -> as I do not have the toolkit I'd like to do it using ActiveX directly, so I tried to do things like shown under the headline 'DIY ActiveX/.NET'
    I tried to load the snippet to a new Excel file but got the error message 'microsoft.office.interop.excel.dll not found' and hence the code is not working. That confuses me a little as I would guess when this dll is not present I cannot access Excel from LabView at all, though my understanding of what I'm really doing so far is quiet limited. ;-)
    Also - as far as I understand from the snippet - when creating a new chart object I should be able the create methodes for it, however when I do a right click on the chart object of an ActiveX Worksheet symbol there are none listed.
    To explain my problems better I added a snippet showing my two problems: The inner of the two while loops shows how I import a 1D array. In the outer loop I seperate the columns. I know that currently this is not working as all data end up in column A of the Excel sheet - so I would need to convert the number of the outer counter to A, B,... or find a different solution.
    Moreover on the snippet I placed an ActiveX Worksheet Property with the Chart Object - as I can see the difference to the Chart Object in the example code from the last link above is the color. However I'm not sure what that means and how to change/ solve this.
    And just to make sure - I know this way the VI does not run as the Chart Object is placed completely wrong - I just did it, so it is included in the snippet.
    I'd be thankful for any suggestions,
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    ExcelAreaScan.png ‏60 KB

    Hello everyone and thanks for the answers.
    I only have the LabView Student Edition available here - is the toolkit included in it too. How can I check if it is installed/ available and in case it is installed - where can I find it?
    Today I had time to take a look at the example
    Create via ActiveX Labview a XY Scatter plot graph on an excel sheet
    It almost does what I want in terms of creating a graph. The only problem I could not fix, is that in this example a sheet is created where only the graph is present. i'd like to add the graph to a previously created worksheet. Today I tried get this working but it seems I stilll don't really understand what I'm doing, I'll post a snippet of my code as soon as I can access the PC with LabView on it again.
    I also took a look at the other example for inserting 2D attays - it seems to be what I need, I just had no time so far to test it, I'll post an update when I could test it.
    Thanks for the help so far!

  • New columns to select in FS10N/FBL3N

    Can I insert new columns for selection in the Report of FS10N/FBL3N?
    Of all the columns that already exist today to selecting and assembling the report, I need to install new fields that are not available. Where do I include this?
    Thanks in advance.

    Hi,
    You can go to T-Code O7R3 and add additional fields for display as per your requirement.
    Regards,
    SAPFICO

  • Add a new column to an "Insert Form" created by HTMLDB Wizard throws Error

    Hi,
    My table design has changed and I had to add 2 new columns.
    The corresponding Insert Form/Report/Update Forms created by the HTMLDB should now reflect the new columns that have been added.
    In report and update forms I did not have a problem but in the Insert form, under Edit Page Process I tried to change the sql and I get the below error
    "Encountered the symbol "end-of-file" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with "
    My Edit Page Process SQL is as below-(Last two columns are the NEW columns i.e CDPL and CDPLCA)
    insert into "L2ENTRIES"
    ("AUTONUML2E",
    "ROLLNO",
    "AWARDCODE",
    "ROLLCLASSCODE",
    "SURNAME",
    "FORENAME",
    "SEX",
    "DOB",
    "PPSNO",
    "M1",
    "M2",
    "M3",
    "M4",
    "M5",
    "M6",
    "M7",
    "M8",
    "M9",
    "M10",
    "M11",
    "M12",
    "M13",
    "M14",
    "M15",
    "M16",
    "FEES",
    "CNULLS",
    "CDUPPPS",
    "CROLL",
    "CAWARDS",
    "CMODULES",
    "CHECKCHAR",
    "CHECKNO",
    "VALIDPPS",
    "VALIDPPSUK",
    "PPSNOPAD",
    "CDPL",
    "CDPLCA")
    values (
    :P3_AUTONUML2E,
    :P3_ROLLNO,
    :P3_AWARDCODE,
    :P3_ROLLCLASSCODE,
    :P3_SURNAME,
    :P3_FORENAME,
    :P3_SEX,
    :P3_DOB,
    :P3_PPSNO,
    :P3_M1,
    :P3_M2,
    :P3_M3,
    :P3_M4,
    :P3_M5,
    :P3_M6,
    :P3_M7,
    :P3_M8,
    :P3_M9,
    :P3_M10,
    :P3_M11,
    :P3_M12,
    :P3_M13,
    :P3_M14,
    :P3_M15,
    :P3_M16,
    :P3_FEES,
    :P3_CNULLS,
    :P3_CDUPPPS,
    :P3_CROLL,
    :P3_CAWARDS,
    :P3_CMODULES,
    :P3_CHECKCHAR,
    :P3_CHECKNO,
    :P3_VALIDPPS,
    :P3_VALIDPPSUK,
    :P3_PPSNOPAD,
    :P3_CDPL,
    :P3_CDPLCA)
    It will be great if some one can assist me in this matter.
    Thanks.

    Resolved this by a simple ";" at the end of the insert sql.
    I did not think a ";" will be necessary because when you edit the page process a ";" is not visible.

  • Inserting new line to a text file at position #

    Hi,.
    Is it possible to do this in java?
    1. Open a new text File (woutFile)
    2. woutFile.write(" line #1\r\n"); // write new line
    3. woutFile.write(" line #2\r\n"); // write new line
    4.woutFile.write(" line #3\r\n"); // write new line
    5. Go to line #2 position on a text file
    6. Insert NEW LINE between line #2 and Line #3
    7. move to the end-of-file
    8.Close the file
    Please help

    Is it possible to do this? please look at question
    inside comments.Your question has already been answered. Beyond that,
    if you have some code and you want to know if it will
    work, then run it and see.The answer was no. It's one of the fundamental properties of files that you cannot insert content in the middle, just at the end. To insert content you first have to make room for it. In this respect a file works like an array and not like a linked list.

  • Looping multiple excel files at a time in ssis and create a new column to insert the files names

    Hi Friend,
    i have one requirement.
    I got around 200 excel files with date as file name like 120101.xls, 120102.xls (YYMMDD).
    I am able to loop all the files and insert data but i am unable to load the files names using ssis.
    Please can any one help to fix this using script task or any other code..
    It is very urgent

    Thank You Vaibhav,
    I want to insert the file name along with the other columns of data from excel.
    like this deriving a new column FILE_NAME
    Your ForEach Loop task must be returning the entire file path, I suppose.
    1. Get the file name from your file path. 
    New variable: FileName 
    Expression   : RIGHT(@[User::FilePath],FINDSTRING(REVERSE(@[User::FilePath]),"\\",1)-1)
    2. Inside Data flow, after Excel source use Dervied Column and use above @FileName
    3. At your OLEDB destinition, use MyFileName.
    -Vaibhav Chaudhari

Maybe you are looking for

  • How do I take one of my pics and make it my wallpaper?

    I'd like to edit one of my pics and use it as a wallpaper. How do I get it the correct size so that it's not stretched and squashed, or tiled? I appreciate your help. Please type slow... I'm a new convert! Trinity

  • Quicktime version best for FCP 3

    Which version of quicktime is best for FCP 3?

  • Move NSS disks from OES2 to another OES2

    Hi, I have old OES2 SP1 server. I install new server and connect it to the tree. Can I move NSS disk from old server to new server and save Trustee ? Old server has two software RAID 1 disks witch one NSS pool and volume.

  • Lower jpeg compression on masters

    This might seem like an odd question but how can I resave masters with lower jpeg compression or even lower resolution to save disk space? Please dont make this a thread lecturing the downsides of actually doing this I know what Im asking of

  • Why am I redirected to the pchome website when I t...

    I go to skype.com and sign in. I go to billing section and try to add a payment method. I get redirected to pchome. Also, I'm trying to reactivate my Skype Number but there doesn't seem to be a way for me to do that. My experience with the skype UI a