Update on nulls in the column vs add column not null default 11 g

Hello

Let's take a scenario following 1. *

We have a large partitioned table LARGE_TABLE1 (say: NUM_ROWS 5 904 977 029, size GB 326) in the Oracle 11 database.

We want to add a new column NEW_COLUMN (NUMBER) and give a value of-999 to NEW_COLUMN each record in this table.
ALTER TABLE LARGE_TABLE1 ADD (NEW_COLUMN NUMBER DEFAULT -999 NOT NULL);
In Oracle 11 it would probably a second since the value of default -999 would be permanently added in metadata without updating each and every record 6 bln.

Take a scenario 2 *

We have another large partitioned table LARGE_TABLE2 (of similar size as LARGE_TABLE1) in the Oracle 11 database.

We have an existing EXISTING_COLUMN (NUMBER) column that contains nulls 90% (90% of scores only contain null values in the field, and 10% of the scores only contain non-null values in this field)

I would like to replace null values in EXISTING_COLUMN with number - 999.

Update the column full Ascension not going :-) and doing so in a loop (the partition partition) would take a few days.

Question:
Do you know a way somehow write this -999 "overall" in the metadata as in scenario 1 instead of updating a null value in all the records to-999? No clever workaround solution would be appreciated...

Edited by: SwPiotr 2012-04-24 07:26
ALTER TABLE LARGE_TABLE1 ADD NEW_COLUMN NUMBER GENERATED ALWAYS AS nvl(col1, -999);

Tags: Database

Similar Questions

  • What is the solution to add is not null to an existing table that has the data

    I have an employee table that contains the data that I want to change the column NOT NULL .i get error saying e-mail
    table cannot be changed when the data is there... any other solution for this?

    I have an employee table that contains the data that I want to change the column not NULL.
    I get error message saying table cannot be changed when the data is there... any other solution for this?

    Create a new column that can contain NULL.
    New column UPDATED with the old data
    remove the old column
    Rename new old column_name column

  • With the help of Vista on the laptop. Receive 3 updates on initialize to the top & stop. Do not install. Party at 3 x through process 80070002. How to fix?

    With the help of Vista on the laptop. Receive 3 updates on initialize to the top & stop.  Do not install.  Party at 3 x through process 80070002. How to fix?  3 updates failed to install: KB2779562, KB2705219 and KB2722913.  Constantly configures updates during startup and shutdown.  Takes a long time for the two workers.  Can anyone give advice?

    To decode 0 x 80070002. X 0 means that it is a hexadecimal number, 8 , error, the first 7 means it a windows error and the rest of Eastern 2, the number, the Windows error.
     
    To search for the error message we need to decimal format. Start the Calculator (Start - All Programs - Accessories - calculator) and choose the menu display - scientific, then the menu display - Hex. Enter 2 Menu display - decimal. It will say 2.
     
    Start an command prompt (Start - All Programs - Accessories - command prompt) and type
     
    net helpmsg 2
     
    and it will say
     
    The system cannot find the specified file.
     
    Use Notepad to search for FATAL and 80070002 in C:\Windows\Windowsupdate.log.
  • I have connected, but when I need to update apps, again request the password, but it does not work?

    I have connected, but when I need to update apps, again request the password, but it does not work?

    Birgitte salvation,

    Have you tried to enter your system password.

    Please let know if it still does not.

    Concerning

    Megha Rawat

  • my windows update Auto setting turns off suddenly. message says "administrator disabled the auto update". I have the admin account, I has not extinguished. I can't install vista sp2 KB98465 pack, update error code 800F0900. Help, please.

    Ideas:

    • Vista
    • This problem occurred after avast is flaggeg error last dec 4 2009
    • I tried to reset the windows update components, but it did not work.

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Hi Agnes Vizcarra,.

    Thank you for visiting Microsoft Answers.

     

    ·         Which version of Windows Vista is installed on your computer?

    ·         Remember to make changes recently?

    This problem occurs if Windows Update has been disabled by one of the following settings:

    ·         Group Policy

    ·         System policy

    ·         Registry

    Method 1

    Try to turn on the auto update by following the steps in the link below:

    How to configure automatic updates by using Group Policy or of registry settings

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

    Method 2

    If you have any security software installed, disable temporarily.

    Method 3

    Download and install the stand-alone package for the Service Pack 2 from the link below:

    Windows Server 2008 Service Pack 2 and Windows Vista Service Pack 2-five language standalone (KB948465)

    http://www.Microsoft.com/downloads/details.aspx?FamilyId=a4dd31d5-F907-4406-9012-a5c3199ea2b3&displaylang=en

    Method 4

    Run a virus scan because it causes sometimes caused by viruses.

    Microsoft Security Essential

    http://www.Microsoft.com/Security_Essentials/

    Link to view:

    Learn how to install Windows Vista Service Pack 2

    http://Windows.Microsoft.com/en-us/Windows-Vista/learn-how-to-install-Windows-Vista-Service-Pack-2-SP2

    Information about Service Pack 2 for Windows Vista and Windows Server 2008

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

    Hope the helps of information. Please post back and we do know.

    Joel S.

  • I get a message (window) that windows needs to be restarted to complete an update when I start the computer. Restart does not help. I saw answers specific to XP for this, but they do not work on Vista...

    Vista SP2
    Trouble started at the time that I have "resolved" the issue of the update with the .NET 1.1 fix

    drjohn64,
    Do you ever date, it tries to install?  If you go to control panel > programs and features > view installed updates. Do you think those who failed?

    One thing you can try is to boot your PC and then run Windows Update.  Also if you have not run a check for Virus\malware then you should do.  Here's a thread that deals with getting rid of items of type malware: get rid of malware

    Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • error message when you try to remove the software from Add/Remove: not managed by exception DLLfunction call crashed

    I'm trying to uninstall Franklin Covey for Outlook.  The program will uninstall not because of the "unhandled exception" FUNCTION DLL CALL CRASHED: fpoInstall_FPOInstall _GetPST file.

    the program is still listed in Add/Remove programs? If Yes, go to cnet.com and download and install revo uninstaller. It's actually better than the regular add/remove path. Revo examines the entire hard drive for that this presence of programs and removes even the registry entries.

  • Select the columns not in the group by clause

    Hello

    My version of DB is 10.0.2

    I have query, where in I need to select two columns more but that should not be part of the group by Clause.

    Does perform a work around?
    SELECT  F.custnum, 
      V.Import_date,
     -- F.ErledigtMM,F.ErledigtGrundMM, (Columns to be selected additionally)
      nvl(sum(nvl(round(V.VerAuf16/1000,2), 0)  +nvl(round(V.VerAuf17/1000,2), 0)  + nvl(round(V.VerAuf18/1000,2), 0)  + nvl(round(V.VerAuf19/1000,2), 0)  + nvl(round(V.VerAuf20/1000,2), 0)  + nvl(round(V.VerAufKAPUn/1000,2), 0)  + nvl(round(V.VerAufKAPVz/1000,2), 0) ), 0)  Mandantenforderung,
      nvl(sum(nvl(round(V.VerAuf4/1000,2), 0) ), 0) Inkassokosten,
      nvl(sum(nvl(round(V.VerAuf5/1000,2), 0) ), 0) KontoFuehrungsgebuehren,
      nvl(sum(nvl(round(V.VerAuf1/1000,2), 0)  + nvl(round(V.VerAuf2/1000,2), 0) ), 0)  Verwertungskosten,
      nvl(sum(nvl(round(V.VerAuf10/1000,2), 0)  + nvl(round(V.VerAuf8/1000,2), 0) + nvl(round(V.VerAuf9/1000,2), 0) ), 0)  Barauslagen,
      nvl(sum(nvl(round(V.VerAuf13/1000,2), 0)  + nvl(round(V.VerAuf14/1000,2), 0) + nvl(round(V.VerAuf15/1000,2), 0)  + nvl(round(V.VerAuf6/1000,2), 0) ),0)  Gerichtskosten,
      nvl(sum(nvl(round(V.VerAuf11/1000,2), 0)  + nvl(round(V.VerAuf12/1000,2), 0)  + nvl(round(V.VerAuf7/1000,2), 0) ), 0) RAKosten,
      TO_CHAR(F.Created_Date,'MM.YYYY') Created_Date_MM ,
      TO_CHAR(F.Created_Date,'YYYY') Created_Date_MMRRRR
    FROM FACM F, VA V 
       WHERE  F.custnum =  DECODE(0,0,F.custnum,0) AND
      F.accnum = V.accnum 
      GROUP BY F.custnum, V.Import_date,TO_CHAR(F.Created_Date,'MM.YYYY') ,TO_CHAR(F.Created_Date,'YYYY'))

    Hello

    Here's what I suggest:

    select
    a.custnum,
    a.import_date,
    b.ErledigtMM,
    b.ErledigtGrundMM,
    a.Mandantenforderung,
    a.Inkassokosten,
    a.KontoFuehrungsgebuehren,
    a.Verwertungskosten,
    a.Barauslagen,
    a.Gerichtskosten,
    a.RAKosten,
    a.Created_Date_MM ,
    a.Created_Date_MMRRRR
    from (
    SELECT  F.custnum,
      V.Import_date,
      nvl(sum(nvl(round(V.VerAuf16/1000,2), 0)  +nvl(round(V.VerAuf17/1000,2), 0)  + nvl(round(V.VerAuf18/1000,2), 0)  + nvl(round(V.VerAuf19/1000,2), 0)  + nvl(round(V.VerAuf20/1000,2), 0)  + nvl(round(V.VerAufKAPUn/1000,2), 0)  + nvl(round(V.VerAufKAPVz/1000,2), 0) ), 0)  Mandantenforderung,
      nvl(sum(nvl(round(V.VerAuf4/1000,2), 0) ), 0) Inkassokosten,
      nvl(sum(nvl(round(V.VerAuf5/1000,2), 0) ), 0) KontoFuehrungsgebuehren,
      nvl(sum(nvl(round(V.VerAuf1/1000,2), 0)  + nvl(round(V.VerAuf2/1000,2), 0) ), 0)  Verwertungskosten,
      nvl(sum(nvl(round(V.VerAuf10/1000,2), 0)  + nvl(round(V.VerAuf8/1000,2), 0) + nvl(round(V.VerAuf9/1000,2), 0) ), 0)  Barauslagen,
      nvl(sum(nvl(round(V.VerAuf13/1000,2), 0)  + nvl(round(V.VerAuf14/1000,2), 0) + nvl(round(V.VerAuf15/1000,2), 0)  + nvl(round(V.VerAuf6/1000,2), 0) ),0)  Gerichtskosten,
      nvl(sum(nvl(round(V.VerAuf11/1000,2), 0)  + nvl(round(V.VerAuf12/1000,2), 0)  + nvl(round(V.VerAuf7/1000,2), 0) ), 0) RAKosten,
      TO_CHAR(F.Created_Date,'MM.YYYY') Created_Date_MM ,
      TO_CHAR(F.Created_Date,'YYYY') Created_Date_MMRRRR
    FROM FACM F, VA V
       WHERE  F.custnum =  DECODE(0,0,F.custnum,0) AND
      F.accnum = V.accnum
      GROUP BY F.custnum, V.Import_date,TO_CHAR(F.Created_Date,'MM.YYYY') ,TO_CHAR(F.Created_Date,'YYYY'))
    ) a,
    FACM b
    where b.custnum = a.custnum 
    

    By the way

    WHERE  F.custnum =  DECODE(0,0,F.custnum,0) AND F.accnum = V.accnum
    

    can be translated into

    WHERE F.accnum = V.accnum
    

    because

    F.custnum =  DECODE(0,0,F.custnum,0)
    

    is always true
    because

    DECODE(0,0,F.custnum,0)
    

    means

    if 0=0 then F.custnum else 0
    
  • Toolbar Yahoo appeared without my consent. Can't get rid of it. Does not appear in the list of Add-ons or in the list of the programs installed for uninstall. (Win7; (FFx5) Please help me remove this annoyance.)

    I was asked to update Java. I had a YAHOO toolbar I made and do not want to. I can't get rid of it. It does not appear on the list of Add-ons, not in the list of programs (for uninstall). Could not find anything with Yahoo in the name. I don't want to use the view, as he returns to the display without my consent - I want not gone permanently.

    The Yahoo uninstall instructions help call for, click on the pencil tool (which tool is not found on this toolbar). Firefox instructions say go to the list of Add-ons, but the Yahoo bar is not there. There are several modules of Java, but I don't know what they are and what happens if they are uninstalled.

    Win 7; Firefox 5.0. Yahoo toolbar worm 2.3.8.20110620112826

    Maybe he is disguised as something else. If so please tell me what you need to uninstall.

    Open Firefox-> go in the Menu Tools-> Add-ons-> Extension section-> remove any add-on suspicious you-> restart Firefox

    If above solution doesn't work, try the following.

    Open Firefox-> go to Menu view-> toolbars-> UNCHECK any suspicious entry toolbar.

    Check if it works.

  • When you try to install windows vista update KB955430, I get the error "WindowsUpdate_800F082F."

    Continue to receive attempts to install KB955430 but get the same error and does not install.  Repeated reboots do not help.  This has happened for several months.

    Well, Carl, I have only 2 suggestions at this point.

    1. start a free incident request for updated Windows support on the problem
    https://support.Microsoft.com/OAS/default.aspx?Gprid=6527

    2. because the SP2 has not been installed (or even offered), start a free SP2 (see previous answer) support incident. Who knows? He might be able to help solve what SP2 & KB955430 installed. ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • How to display a list of the columns (search bar - not displayed) in ascending order

    Hello

    I'll have an interactive report...
    In the Search bar we have to Select columns, unless we must do not display it.
    where all the columns (not shown) are listed.
    How can we display these columns in increasing order

    Thank you
    Deepak

    You want to display these columns in the IR?

    In the affirmative. Select the column you want to display, and then click on the the ' > '.
    In the interactive report regions - source, where you have your query to select columns use to rank them by order of the Association.

    You want to keep these columns as "do not display" and make them in the Association order it?
    Select all the columns to display and return the columns selections making "Not displayed" region order assn.
    Or in the query, select the columns in the desired order.

    I don't know if I'm helping. I fell like I got your question all wrong. Still...

    Published by: machan on December 11, 2009 11:01

  • Do not update the column if the source column is null

    Hi all
    I'm trying to update some columns on the target, I won't update the column if the source is NULL for the column (do not replace the old value if the new value is zero). How can I do this using OWB. I use 11,1 g.

    Any help will be greatly appreciated.

    Thank you
    Ravi

    There are a few ways to do this:

    First of all, you can add your target to the canvas a second time as a source, an outer join to the source of queries on the same fields that you use in your target match constraint, and then run the new value and the existing value in an expression to generate the control you need and send the existing value if the new value is null.

    Alternatively, you can use a splitter on the lines with a single stream going where your field is null in this case update you the target without updating this field and the other the field update stream. This means that the generated code will now be an update of re-encoding re - query the same sources for the second pass, and that any recovery strategy you are not dependent on each mapping succeeding or failing as a total unit will have to be reconsidered.

    Or, of course, you can just put a trigger on the table to check the: new.value and overwrite it with the: if old.value: new.value is null.

    Mike

  • update of NULL in the column with the values of the adjacent column

    Examples of data

    with test_data as
    (select 1 as one, null as two, 2 as three,5 as four, 6 as five, null as six from dual
    union all
    select 1 as one, null as two, 2 as three,5 as four, 6 as five, null as six from dual)
    select * from test_data;
    

    This is one of those cases, the case may be where any value of a column can be null

    or two similar columns can be null. If the column is null then I want to update the adjacent column

    average value of the column, if the first column is null so I want to take the next non-null column and update, if the last column is null

    so I want to take prev not zero column and to update.

    In this case would be my expected output

    Un Two Three Four Five Six
    11.52566
    123566

    Prospects for the future the suggesion or advice.

    Or, using Analytics:

    SQL> with test_data (id, one, two, three, four, five, six) as (
      2    select 1, 1   , null, 2   , 5, 6, null  from dual union all
      3    select 2, 1   , null, 3   , 5, 6, null  from dual union all
      4    select 3, 1   , null, null, 5, 6, null  from dual union all
      5    select 4, null, null, null, 5, 6, null  from dual
      6  )
      7  select *
      8  from (
      9    select id
     10         , cell
     11         , case when next_nn is not null and prev_nn is not null
     12             then (next_nn + prev_nn)/2
     13             else nvl(next_nn, prev_nn)
     14           end val
     15    from (
     16      select id
     17           , cell
     18           , val
     19           , last_value(val) ignore nulls over(partition by id order by cell) as prev_nn
     20           , first_value(val) ignore nulls over(partition by id order by cell range between current row and unbounded following) as next_nn
     21      from test_data
     22      unpivot include nulls (val for cell in (one as 1, two as 2, three as 3, four as 4, five as 5, six as 6) )
     23    )
     24  )
     25  pivot ( min(val) for cell in (1 as "ONE", 2 as "TWO", 3 as "THREE", 4 as "FOUR", 5 as "FIVE", 6 as "SIX") )
     26  ;
    
            ID        ONE        TWO      THREE       FOUR       FIVE        SIX
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
             1          1        1,5          2          5          6          6
             2          1          2          3          5          6          6
             3          1          3          3          5          6          6
             4          5          5          5          5          6          6
    
  • Update updated the columns with null are excluded from the DB adapter

    Hi all

    My fusion system interacts with DB2 using the DB adapter.

    I have a script that I need to update a flag in the table after completing my bpel workflow. But by updating the value of indicator to "Processsed", there are other columns with a NULL value.

    How to solve this problem. I don't want to do, the other columns should not be alerted.

    Thank you

    Richa

    Hello

    The issue has been resolved. In fact, I've updated the update statement, excluding items that couldnot be updated top link mappings. I had to create a new adapter and it worked.

    Concerning

  • ALTER TABLE with the column NULL time consuming

    Hello

    I have a table with nearly 2 million documents (about 10 GB size table) when I perform the following change statement its run fast

    ALTER TABLE tbl_1 ADD (DEFAULT col_4 NUMBER 100 NOT NULL);

    but when I do not give the NOT NULL in the alter its taking a long time to complete this i.e tbl_1 of ALTER TABLE ADD (NUMBER col_4 by DEFAULT 100); once I do the column as NOT NULL.

    Can someone explain why is it happening like that regarding the execution point.

    Thanks in advance.

    I can reproduce the effect in 11.2.0.1 - but not in 12.1.0.1.

    drop table tbl_1;

    create table tbl_1

    as

    Select rownum id

    , lpad ('* ', 50,' *') padding

    of the double

    connect by level<=>

    ALTER TABLE tbl_1 ADD (NUMBER col_4 by DEFAULT 100);

    --> slow in 11.2.0.1; fast 12.1.0.1

    ALTER TABLE tbl_1 ADD (DEFAULT col_4 NUMBER 100 NOT NULL);

    --> Quick 11.2.0.1 and 12.1.0.1

    A SQL trace for two operations (11g) shows that the altar slow (without the constraint explicit non-null) made explicit (and tedious) update of any row in the table:

    Update 'TBL_1"set"COL_4"= 100

    call the query of disc elapsed to cpu count current lines

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Parse        1      0.00       0.02          0          1          0           0

    Run 1 11,63 33.56 8336 1016125 2053531 1000000

    Fetch        0      0.00       0.00          0          0          0           0

    ------- ------  -------- ---------- ---------- ---------- ----------  ----------

    Total 2 11,63 33,58 8336 1016126 2053531 1000000

    The other trace file does not contain the explicit Update. I guess in the optimized case that oracle stores somewhere that col_4 has the value 100 and updates only the line of the block after completing DML operations. But that's just a guess.

Maybe you are looking for

  • Re: unable to remove the toshiba bluetooth stack or install another version

    Hello I installed Toshiba Bluetooth Stack on my laptop Toshiba Satellite p300. (Vista) The question I'm getting is the CD has not installed the software completely, but is shown in Add & Remove Programs, when I click on uninstall I get error 2753.I c

  • Problems with my Nintendo DS.

    Hello! I hope someone can help me because I really don't know what to try more. I recently bought a WRT 160N v2 and My Nintendo DS simply REFUSES to connect to the Internet (when it used to work perfectly with my previous router, a USRobotic). First

  • Printer Officejet 6500 E709a wire to the router via USB

    Can I connect my Officejet 6500 E709a via the USB connection to my router 9100EM Ultraline series 3 model so that it can be seen by both of my PC, which is connected directly to the router via LAN Ethernet ports? If so, what measures are necessary? A

  • To remove the error message about the network drive

    I have W7 Home and recently restructured.   I had this problem of reformatting finally a long time ago and it is solved but do not remember how.  Whenever I boot, I get the message "connection impossible network drives.  When I click it, I see the Ep

  • BSOD for years

    Hello, I have an Alienware M17, under Windows 7 Home Premium. I'm sorry to be short here, but I'm just extremely frustrated and finally decided to ask for help lol. Would be really grateful if someone where able to help me here. ---------------------