How update statement works

Hi all,
can you guys help me in understanding how an update statement works in oracle...
Thanks
Rajesh

i mean what happens in background in oracle server
when i fire a update statement.The oracle server puts the old data (i.e before updation) into the RBS and then updates the rows with the new data.
Regards
Amit Raghuvanshi

Similar Messages

  • HOW UPDATE INTERNAL WORKS

    Hi,
    My question is related to the architecture. I don't find much information on google.
    The question is how Oracle update statement works on the background? My friend and myself had a debate that update works internally as delete and insert statements. It means when you run update, first it deletes the row and insert the row with new update values.
    But I don't agree his view on this.
    Can anyone of you clarify how oracle update statement works internally? Thanks in advance..
    Regards,
    Robin

    >
    It means when you run update, first it deletes the row and insert the row with new update values.
    But I don't agree his view on this.
    >
    But you didn't say what your view is!
    Generally speaking this doesn't happen unless the ROWID is changing. This can happen for an update of the partition key of a partitioned table that moves the row to a different partition (and maybe even a different tablespace and file. For that case Oracle WILL delete the record and reinsert it in the new location.
    Rows are stored in row pieces. So when a row is updated then one or more pieces have to be updated. Depending on which row piece is affected and what, if anything is in the block after that row piece the row piece may need to be moved (rewritten) to another location in the block or even to another block.
    See How Table Data Is Stored in the Database Concepts doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28318/schema.htm

  • Update statement  works in oracle RAC

    Hi Experts,
    How the update statement works in oracle RAC environment.
    And why we need a separate redo for each instance what will happen if we wont give.
    Regrds
    Suneel

    user1175505 wrote:
    Hi Experts,
    How the update statement works in oracle RAC environment.UPDATE does not know or care if it on RAC or single instance.
    And why we need a separate redo for each instance what will happen if we wont give.you can't start Oracle DB without any REDO.
    Handle:     user1175505
    Status Level:     Newbie
    Registered:     Jun 9, 2010
    Total Posts:     610
    Total Questions:     249 (182 unresolved)
    WOW! Why do you waste your time here when you rarely get answers to your questions?

  • How a update statement works internally in oracle

    Hi,
    I just wanted to know when a user issues a update (any DML) statement, what are all the steps involved?
    Like when user updated some statement, the modified block goes to the undo tablespace and new data will be stored in the user PGA and when user issues a commit statement.Does it delinked it from the uno tablespace and lgwr flushed the block to the redo logfile(does the lgwr also flushed the uncommited changes to the logfile as datafile stores the committed as well as uncomitted data).Can anybody suggest me how all the things work internally?

    Hi,
    Many of the people post across the same questions and lot of discussions carried out. You can you answer straight from Oracle Docs.
    Any how refer to the following below links
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:288016031632
    Update Statement-10G
    - Pavan kumar N

  • How commit statement works

    Hi,
    I want to know the procedure of how commit statement executes.
    I have a transaction in which I have updated 10000 rows of table A having 10lakh records and after this update I am updating 1 row in table B having 1000 records.
    after both these update statement I am executing commit statement.
    so, how this commit will work? does it commits the data in sequential order of updation of table A and B or it will be parallel for both the tables? Does it take time to do the commit?
    Thanks

    Arjit wrote:
    Hi,
    I want to know the procedure of how commit statement executes.
    I have a transaction in which I have updated 10000 rows of table A having 10lakh records and after this update I am updating 1 row in table B having 1000 records.
    after both these update statement I am executing commit statement.
    so, how this commit will work? does it commits the data in sequential order of updation of table A and B or it will be parallel for both the tables? Does it take time to do the commit?
    Thankswhen all else fails Read The Fine Manual
    http://docs.oracle.com/cd/E11882_01/server.112/e25789/sqllangu.htm#sthref864
    http://docs.oracle.com/cd/E11882_01/server.112/e25789/transact.htm#sthref1302
    http://docs.oracle.com/cd/E11882_01/server.112/e25789/transact.htm#sthref1320

  • Update Statement Works Differently on Two Different Systems

    I write the code
    Data:  it_eaus like eaus occurs 0 with header line,
            wa_eaus type eaus.
    select * from eaus into table it_eaus where auszbeleg = '000000000001'  and storausz = 'X'.
    if sy-subrc = 0 .
    wa_eaus-aedat = ''.
    wa_eaus-aenam = ''.
    wa_eaus-storausz = ''.
    modify it_eaus from wa_eaus transporting aedat aenam storausz where auszbeleg = '000000000001'.
    update eaus from table it_eaus.
    endif.
    Data:  it_eausv like eausv occurs 0 with header line,
            wa_eausv type eausv.
    select * from eausv into table it_eausv where auszbeleg = '000000000001'  and storausz = 'X'.
    if sy-subrc = 0 .
    wa_eausv-aedat = ''.
    wa_eausv-aenam = ''.
    wa_eausv-storausz = ''.
    modify it_eausv from wa_eausv transporting aedat aenam storausz where auszbeleg = '000000000001'.
    update eausv from table it_eausv.
    endif.
    In One system Update Statement Updates the EAUS Table after Update Statement and
    in other system Update Statement Updates the EAUS Table after completion of all the code.
    Will you please help me on that?

    Hi Prashant,
    Thanks for your reply
    But the issue is the above code is working in one system and update the table after
    staement 
    update eaus from table it_eaus.
    But in another system it is not updated at this system it updates the record after completion on program.

  • How select statement works

    i like to know the in depth details how oracle process the select query...how it reads from the data block

    Straight from the concept manual:
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c01_02intro.htm#3437
    An Example of How Oracle Works
    The following example describes the most basic level of operations that Oracle performs. This illustrates an Oracle configuration where the user and associated server process are on separate machines (connected through a network).
    An instance has started on the computer running Oracle (often called the host or database server).
    A computer running an application (a local machine or client workstation) runs the application in a user process. The client application attempts to establish a connection to the server using the proper Oracle Net Services driver.
    The server is running the proper Oracle Net Services driver. The server detects the connection request from the application and creates a dedicated server process on behalf of the user process.
    The user runs a SQL statement and commits the transaction. For example, the user changes a name in a row of a table.
    The server process receives the statement and checks the shared pool for any shared SQL area that contains a similar SQL statement. If a shared SQL area is found, then the server process checks the user's access privileges to the requested data, and the previously existing shared SQL area is used to process the statement. If not, then a new shared SQL area is allocated for the statement, so it can be parsed and processed.
    The server process retrieves any necessary data values from the actual datafile (table) or those stored in the SGA.
    The server process modifies data in the system global area. The DBWn process writes modified blocks permanently to disk when doing so is efficient. Because the transaction is committed, the LGWR process immediately records the transaction in the online redo log file.
    If the transaction is successful, then the server process sends a message across the network to the application. If it is not successful, then an error message is transmitted.
    Throughout this entire procedure, the other background processes run, watching for conditions that require intervention. In addition, the database server manages other users' transactions and prevents contention between transactions that request the same data.

  • UPDATE statement in Receiver JDBC adapter

    Hi all,
    I would like to use UPDATE statement in my receiver JDBC adapter and would like to know how this UPDATE statement works in following case.
    1) If i have 10 records to be updated in database, whether Commit happens at the end of all 10 records updation OR it will be for every record update?
    Regards

    Hi,
    Then let me construct my query this way...
    i have 10 records that needs to be updated to database, say For Ex: 7 records are updated successfully and 8th record has issue in updating the table.
    In this case i would like to ROLLBACK entire 10 records with out committing any thing.
    So if i use your 2nd option, it should perform as i expected right?
    Regards

  • Update statement takes too long to run

    Hello,
    I am running this simple update statement, but it takes too long to run. It was running for 16 hours and then I cancelled it. It was not even finished. The destination table that I am updating has 2.6 million records, but I am only updating 206K records. If add ROWNUM <20 to the update statement works just fine and updates the right column with the right information. Do you have any ideas what could be wrong in my update statement? I am also using a DB link since CAP.ESS_LOOKUP table resides in different db from the destination table. We are running 11g Oracle Db.
    UPDATE DEV_OCS.DOCMETA IPM
    SET IPM.XIPM_APP_2_17 = (SELECT DISTINCT LKP.DOC_STATUS
    FROM [email protected] LKP
    WHERE LKP.DOC_NUM = IPM.XIPM_APP_2_1 AND
    IPM.XIPMSYS_APP_ID = 2
    WHERE
    IPM.XIPMSYS_APP_ID = 2;
    Thanks,
    Ilya

    matthew_morris wrote:
    In the first SQL, the SELECT against the remote table was a correlated subquery. the 'WHERE LKP.DOC_NUM = IPM.XIPM_APP_2_1 AND IPM.XIPMSYS_APP_ID = 2" means that the subquery had to run once for each row of DEV_OCS.DOCMETA being evaluated. This might have meant thousands of iterations, meaning a great deal of network traffic (not to mention each performing a DISTINCT operation). Queries where the data is split between two or more databases are much more expensive than queries using only tables in a single database.Sorry to disappoint you again, but with clause by itself doesn't prevent from "subquery had to run once for each row of DEV_OCS.DOCMETA being evaluated". For example:
    {code}
    SQL> set linesize 132
    SQL> explain plan for
    2 update emp e
    3 set deptno = (select t.deptno from dept@sol10 t where e.deptno = t.deptno)
    4 /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 3247731149
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |IN-OUT|
    | 0 | UPDATE STATEMENT | | 14 | 42 | 17 (83)| 00:00:01 | | |
    | 1 | UPDATE | EMP | | | | | | |
    | 2 | TABLE ACCESS FULL| EMP | 14 | 42 | 3 (0)| 00:00:01 | | |
    | 3 | REMOTE | DEPT | 1 | 13 | 0 (0)| 00:00:01 | SOL10 | R->S |
    PLAN_TABLE_OUTPUT
    Remote SQL Information (identified by operation id):
    3 - SELECT "DEPTNO" FROM "DEPT" "T" WHERE "DEPTNO"=:1 (accessing 'SOL10' )
    16 rows selected.
    SQL> explain plan for
    2 update emp e
    3 set deptno = (with t as (select * from dept@sol10) select t.deptno from t where e.deptno = t.deptno)
    4 /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 3247731149
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |IN-OUT|
    | 0 | UPDATE STATEMENT | | 14 | 42 | 17 (83)| 00:00:01 | | |
    | 1 | UPDATE | EMP | | | | | | |
    | 2 | TABLE ACCESS FULL| EMP | 14 | 42 | 3 (0)| 00:00:01 | | |
    | 3 | REMOTE | DEPT | 1 | 13 | 0 (0)| 00:00:01 | SOL10 | R->S |
    PLAN_TABLE_OUTPUT
    Remote SQL Information (identified by operation id):
    3 - SELECT "DEPTNO" FROM "DEPT" "DEPT" WHERE "DEPTNO"=:1 (accessing 'SOL10' )
    16 rows selected.
    SQL>
    {code}
    As you can see, WITH clause by itself guaranties nothing. We must force optimizer to materialize it:
    {code}
    SQL> explain plan for
    2 update emp e
    3 set deptno = (with t as (select /*+ materialize */ * from dept@sol10) select t.deptno from t where e.deptno = t.deptno
    4 /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 3568118945
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |IN-OUT|
    | 0 | UPDATE STATEMENT | | 14 | 42 | 87 (17)| 00:00:02 | | |
    | 1 | UPDATE | EMP | | | | | | |
    | 2 | TABLE ACCESS FULL | EMP | 14 | 42 | 3 (0)| 00:00:01 | | |
    | 3 | TEMP TABLE TRANSFORMATION | | | | | | | |
    | 4 | LOAD AS SELECT | SYS_TEMP_0FD9D6603_1CEEEBC | | | | | | |
    | 5 | REMOTE | DEPT | 4 | 80 | 3 (0)| 00:00:01 | SOL10 | R->S |
    PLAN_TABLE_OUTPUT
    |* 6 | VIEW | | 4 | 52 | 2 (0)| 00:00:01 | | |
    | 7 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6603_1CEEEBC | 4 | 80 | 2 (0)| 00:00:01 | | |
    Predicate Information (identified by operation id):
    6 - filter("T"."DEPTNO"=:B1)
    Remote SQL Information (identified by operation id):
    PLAN_TABLE_OUTPUT
    5 - SELECT "DEPTNO","DNAME","LOC" FROM "DEPT" "DEPT" (accessing 'SOL10' )
    25 rows selected.
    SQL>
    {code}
    I do know hint materialize is not documented, but I don't know any other way besides splitting statement in two to materialize it.
    SY.

  • Update statement not working PL/SQL block

    Hi friends,
    My code is written the following way:
    declare
    var1 number;
    var2....
    Cursor c1 <select something>;
    Cursor c2 <select something>
    Begin
    Insert into table1 <different values>;
    Commit;
    /* first update statement */
    Update table1 set table1.col3 = (select col3 from table2 where table2.col1 = table1.col1 and table2.col2 = table1.col2);
    commit ;
    /* 2nd update statement */
    update table1 set table1.col4 = (select col4 from table3 where table3.col1 = table1.col1 and table3.col2 = table1.col2);
    commit ;
    for r2 in c2 loop
    update table1
    end loop;
    end;
    This code works till 1st update statement. But after that, even if I let my code run overnight, nothing happens. There are appropriate indexes on tables where join is done. All tables are in one schema.
    What could be the reason?

    darshilm wrote:
    /* first update statement */
    Update table1 set table1.col3 = (select col3 from table2 where table2.col1 = table1.col1 and table2.col2 = table1.col2);This is an unconstrained updated - meaning that it instructs the database that every single row in TABLE1 needs to be updated.
    For every single row, the "update" SQL has to be executed and a SELECT performed on TABLE2.
    Let's say there are a 100,000 rows in TABLE1. This means that the SELECT to find the updated value has to be executed a 100,000 times.
    Let's say that there are a 200,000 rows in TABLE2. This means that each time that SELECT runs, it potentially hits 200,000 rows. Does it do it via a full table scan? Index range scan?
    At what cost? Hitting the very same data set again and again and again, 100,000 times in a row.
    And that is only the start of your code... and you wonder why it does not seem to finish?
    Data processing in a RDBMS is about how to do the minimal amount of I/O to achieve the desired result. For example, instead of hitting TABLE2 100,000 times, you can write code to hit it once by joining it with TABLE1 and creating an "updateable view" of TABLE1 that can be updated with the join values of TABLE2.
    You also seem to use PL/SQL cursors to perform row-row (and slow-by-slow) processing. This typically pulls data from the SQL engine into the PL engine and then push that very same data from the PL engine to the SQL engine.. It is a lot faster and more efficient (and scalable) to rather stay inside the SQL engine and do data set processing there (as oppose to row-by-row on the client side).
    Performance in a RDBMS is primarily determined by the designer and the developer... are functions of how well designed the data model is, and how well designed and written the code is.

  • How to tune this update statement?

    Hello,
    I have to solve the following task:
    Update every row in table A which has an appropriate row in table B and log what you have done in a log-table.
    It is possible that there are more than one fitting rows in table A for a row in table B.
    My first approach is looping over the table B and doing an update of table A for every entry in table B.
    This works and looks like this:
    Table A:
    PK number (This is the primary key of this table)
    KEY number
    Table B:
    KEY_OLD number
    KEY_NEW number
    Log table:
    PK number
    KEY_OLD number
    KEY_NEW number
    declare
      TYPE PK_TAB_TYPE IS TABLE OF number INDEX BY BINARY_INTEGER;
      v_tab_PK       PK_TAB_TYPE;
      v_empty_tab_PK PK_TAB_TYPE;
    begin
      for v_rec in (select * from table_B) loop
        v_tab_PK := v_empty_tab_PK;  /* clearing the array */
        update table_A
        set    KEY = v_rec.KEY_NEW
        where (KEY = v_rec.KEY_OLD)
        returning PK bulk collect into v_tab_PK;
        if (v_tab_PK.count > 0) then
          for i in v_tab_PK.first..v_tab_PK.last loop
            insert into TMP_TAB_LOG(PK, KEY_OLD, KEY_NEW)
              values (v_tab_PK(i), v_rec.KEY_OLD, v_rec.KEY_NEW);
          end loop;
        end if;
      end loop;
    end;Because the table B can have up to 500.000 entries (and the table A has even more entries) this solution will cause many update-statements.
    So I am looking for a solution which has better performance.
    My second approach was using an correlated update and looks like this:
    declare
      TYPE PK_TAB_TYPE IS TABLE OF number INDEX BY BINARY_INTEGER;
      v_tab_PK            PK_TAB_TYPE;
      v_empty_tab_PK PK_TAB_TYPE;
      v_tab_NewKey    PK_TAB_TYPE;
    begin
      v_tab_PK         := v_empty_tab_PK;  /* clear the arrays */
      v_tab_NewKey := v_empty_tab_PK;
      update table_A a
      set    KEY = (select KEY_NEW from table_B where (KEY_OLD = a.KEY))
      where exists (select 'x' as OK
                         from   table_B
                         where (KEY_OLD = a.KEY)
      returning PK, KEY bulk collect into v_tab_PK, v_tab_NewKey;
      if (v_tab_PK.count > 0) then
        for i in v_tab_PK.first..v_tab_PK.last loop
          insert into TMP_TAB_LOG_DUB(PK, KEY_OLD, KEY_NEW)
            values (v_tab_PK(i), null, v_tab_NewKey(i));
        end loop;
      end if;
    end;Now I have only one update statement.
    The only thing missing in this second approach is the old KEY before the update in the log table.
    But I have no idea how to get the old value.
    Is there a possibility to modify this second approach to get the old value of the KEY before the update to write it in the log-table?
    And now I need your help:
    What is the best way to get a performant solution for my task?
    Every help appreciated.
    Regards Hartmut

    Below is a script you can run in another testing schema to do the update with logging..... I have created the tables (A and B) with primary key constraints defined...
    create table table_a(pk number primary key
    , key number);
    create table table_b(key_old number primary key
    , key_new number);
    create table TMP_TAB_LOG_DUB(pk number primary key
    , key_old number
    , key_new number);
    ---------insert test data
    insert into table_a values(1,2);
    insert into table_a values(2,2);
    insert into table_a values(3,2);
    insert into table_a values(11,1);
    insert into table_a values(12,1);
    insert into table_a values(13,1);
    insert into table_a values(21,4);
    insert into table_a values(22,4);
    insert into table_a values(23,4);
    commit;
    insert into table_b values(1,3);
    insert into table_b values(4,2);
    commit;
    ----- insert to log
    insert into TMP_TAB_LOG_DUB(PK, KEY_OLD, KEY_NEW)
    select a.pk
    , a.key as key_old
    , b.key_new as key_new
    from table_a a
    join table_b b on a.key = b.key_old;
    ----- update table_a
    update(select a.pk
    , a.key as key_old
    , b.key_new as key_new
    from table_a a
    join table_b b on a.key = b.key_old)
    set key_old = key_new;
    commit;

  • How to create view that has an update statement

    Tools: MS Management Studio SQL 2008 R2
    Code:
    Create View as Mocha
    UPDATE dbo.Cola
    SET Login_ID = Replace(PE15,RTRIM(Cast(Login_ID),'')
    UPDATE dbo.cola
    SET P4 = NullIf(P4,'')
    I would like to create a database object "View" to hand it over to a user and run the script. How I would create a a view that would accept an update statement. Are any work around to accomplish this goal

    Not quite sure what you want to achieve.
    However, if your view displays rows from a single table and each row relates to exactly one row in the source table (no aggregates, no join, no transformation) then you can update it.  The update will be executed on the table it refers to.
    If you view is more complex, contains joins, aggregates and such, you can create a trigger on it to update the base table(s).
    The conditions for a view to be updatable are a little more complex then what I wrote but you can find it here under "updatable view":
    http://msdn.microsoft.com/en-CA/library/ms187956.aspx
    In the end, you would have a view which displays rows and can be updated.
    If all you want is to modify rows without viewing them then HuaMin Chen's solution is the one for you, create a stored procedure instead.

  • HT2357 So how does this work on Mountain Lion? I cannot seem to ignore the iTunes 11 updates, which now seem to appear every 5 minutes!!

    So how does this work on Mountain Lion? I cannot seem to ignore the iTunes 11 updates, which now seem to appear every 5 minutes!!

    Fantastic!  Didn't work at first so restarted App store and tried again.  This time it asked 'ignore update'.  All gone!

  • How can i use multiple row subquery in update statement

    Hai All
    I using group function in my update statement.. and i need to update more rows so i need to use multiple row
    subquery pls tell me how to use multiple row subquery in update statement
    For example
    while i am using this like this i got an error
    update dail_att set outtime in (select max(r2.ptime) from temp_att where empcode=r2.enpno and
    barcode=r2.cardn and attend_date=r2.pdate group by enpno,pdate,cardn);
    Pls tell me how to use with example
    Thanks & regards
    Srikkanth.M

    Hai Man
    Thanks for ur response Let me clear what i need
    First step Fetch the records as text file and stores into table T1
    and the next step is i have seperated the text using substring and stores in different columns of a table
    There are two shifts 0815 to 1645 and 1200 and 2000
    Here I rep IN and O rep OUT
    Empno date time inout
    001 01-01-10 0815 I
    002 01-01-10 0815 I
    003 01-01-10 0818 I
    001 01-01-10 1100 0
    001 01-01-10 1130 I
    002 01-01-10 1145 0
    002 01-01-10 1215 I
    004 01-01-10 1200 I
    005 01-01-10 1215 I
    004 01-01-10 1315 O
    004 01-01-10 1345 I
    001 01-01-10 1645 0
    002 01-01-10 1715 0
    003 01-01-10 1718 0
    004 01-01-10 2010 0
    005 01-01-10 2015 0
    This is my T1 table i have taken data from text file and stored in this table from this table i need to move data to another table T2
    T2 contains like this
    Empno Intime Intrin Introut Outtime Date
    001 0815 1100 1130 1645 01-01-10
    002 0815 1145 1215 1715 01-01-10
    003 0818 1718 01-01-10
    004 1200 1315 1345 2010 01-01-10
    005 1215 2015 01-01-10
    This what i am trying to do man but i have little bit problems Pls give some solution with good example
    And my coding is
    declare
         emp_code varchar2(25);
    in_time varchar2(25);
    out_time varchar2(25);
    Cursor P1 is
    Select REASON,ECODE,READMODE,EMPD,ENPNO,FILL,PDATE,PTIME,INOUT,CARDN,READERN
    From temp_att
    group by REASON,ECODE,READMODE,EMPD,ENPNO,FILL,PDATE,PTIME,INOUT,CARDN,READERN
    ORDER BY enpno,pdate,ptime;
    begin
         for r2 in p1 loop
    declare
    bar_code varchar2(25);
    begin
    select barcode into bar_code from dail_att where empcode=r2.enpno and attend_date=r2.pdate;
    For r3 in (select empcode,empname,barcode,intime,intrin,introut,addin,addout,outtime,attend_date from dail_att)loop
    if r2.inout ='O' then
    update dail_att set outtime =(select max(r2.ptime) from temp_att where empcode=r2.enpno and barcode=r2.cardn and attend_date=r2.pdate group by r2.cardn,r2.enpno,r2.pdate );
    end if;
    end loop;     
    exception
         when no_data_found then
         if r2.inout ='I' then
                   insert into dail_att(barcode,empcode,intime,attend_date)(select r2.cardn,r2.enpno,min(r2.ptime),r2.pdate from temp_att group by r2.cardn,r2.enpno,r2.pdate );
         end if;
    end;
    end loop;
    commit;     
         end;
    Pls tell me what correction i need to do i the update statement i have used a subquery with group function but when i used it will return only one row but my need is to return many rows and i need to use multiple row subquery
    and how can i use it in the update statement
    Thanks In Advance
    Srikkanth.M

  • How to use the updated value in the same update statement

    Hello,
    I just wonder how to use the updated new value of other column in the same udpate statement. I am using Oracle 11.2, and want to update the two columns with one update statement as following:
    create table tb_test (id number(5), tot number(5), mon_tot number(5));
    update tb_test set (tot = 15, mon_tot = tot *15) where id = 1;
    ...I would like to update both tot and mon_tot column, the value of mon_tot shall be determinted by the new value of tot.
    Thanks,
    Edited by: 939569 on 1-Feb-2013 7:00 AM

    Edit: example added
    SQL> create table tb_test
      2  ( id number(5)
      3  , tot number(5)
      4  , mon_tot number generated always as (tot*15) virtual
      5  );
    Table created.
    SQL> insert into tb_test (id, tot) values (1, 5);
    1 row created.
    SQL> select * from tb_test;
            ID        TOT    MON_TOT
             1          5         75
    1 row selected.
    SQL> update tb_test
      2  set    tot = 15
      3  where  id = 1;
    1 row updated.
    SQL> select * from tb_test;
            ID        TOT    MON_TOT
             1         15        225
    1 row selected.

Maybe you are looking for

  • Coldfusion cfwindow

    Hi, I am currently working in Coldfusion 9.There is a requirement to build cfwindow. But I am not able to change the border color of this cfwindow. I was able to change the header style. But not the border color. Another thing is even I have used cen

  • Oracle-Validated RPM install on OEL 4.5 x64

    I've had problems trying to install the Oracle-Validated RPM on OEL 4.5 x64. Up2Date would hang. Anyone else try using the RPM on OEL 4.5?

  • Dynamic links

    Hello all iWeb fab, but has anyone looked into creating dynamic links to iTunes, eg, if you have a Top 10 Playlist in your iWeb, when it change in itunes get it to automatically update in iWeb, would be cool feature.

  • Since I updated to Mac OS x 10.6.8, I am unable to burn a CD on iTunes

    Updated my Macbook to Snow Leopard a few months ago because it stopped getting all updates (thanks Apple). Since I've updated, my iTunes is currently on version 11.1.5 and it will no longer burn CDs. The CD loads and initialises the burning process b

  • Photos with Info??

    Can photos on the iPad have words underneath them like what can be done on a PC?   So the picture has some info with it that says its date etc.