How to update a table with the time of insert instead of time of commit

dear,
i have 10 record at source side which needs to be injected in a target table ;
the record creation date is injected with the systimestamp -
when commiting it takes for all the same timestamp for all records( at commit time ) however I would like to insert the timestamp at INSERT moment to have a unique timestamp - id est at INSERT time.
Can anyone please adviseN?
Thanks
Erik
Edited by: 845498 on 29-aug-2012 1:36

845498 wrote:
dear,
when commiting it takes for all the same timestamp for all records( at commit time ) Not true about commit time. True about same time. Function SYSDATE is always calculated once for SQL statement no matter how many times and for how many rows it is referenced. So when you issue:
insert
  into target(insert_date)
  select sysdate
    from  source
/All inserted rows will have same insert_date. Now keep in mind, Oracle date datatype precision is one second. So unless your insert of 10 rows takes more than a second (which would be a problem on its own), date precision will not give you what you want. You would need timestamp. But again, same as SYSDATE, SYSTIMESTAMP is called once per statement. To call it row each row and reference you need to create user-defined function:
create or replace
  function get_systimestamp
    return timestamp
    is
    begin
        return systimestamp;
end;
/Now:
SQL> select  systimestamp,
  2          get_systimestamp
  3    from  hr.employees
  4  /
SYSTIMESTAMP                        GET_SYSTIMESTAMP
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.671000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
SYSTIMESTAMP                        GET_SYSTIMESTAMP
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.687000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000
29-AUG-12 01.55.23.656000 PM -04:00 08/29/2012 13:55:23.765000000.
.SY.

Similar Messages

  • How to update two tables with trigger

    Hi:
    how to update two tables with trigger ?
    I have two tables :
    (1)ASIA
    MI number;
    (2)ASIA_P
    ID number;
    When I insert a new value into the asia.MI ,I also can
    insert the same value into the asia_p.id field.
    I have write a trigger as follows but it does't work.
    create or replace trigger MI_TRG
    before insert on asia
    for each row
    declare
    seq number;
    begin
    select MI_SEQ.Nextval into seq from dual;
    :new.MI:=seq;
    insert into ASIA_PRO(MI_ID)
    values
    (seq);
    end MI_TRG;
    How to realize it ?
    thanks
    zzm

    Why do you say it does not work?

  • How to create a table with datatype blob and insert a pdf file (ravi)

    how to create a table with datatype blob and insert a pdf file,
    give me the explain asap
    1.create the table?
    2.insert the pdffiles into tables?
    3.how to view the files?
    Thanks & Regards
    ravikumar.k
    Edited by: 895044 on Dec 5, 2011 2:55 AM

    895044 wrote:
    how to create a table with datatype blob and insert a pdf file,
    give me the explain asapPerhaps you should read...
    {message:id=9360002}
    especially point 2.
    We're not just sitting here waiting to answer your question as quickly as possible for you.

  • How to update application table with notification id

    What is the best method for updating an application table with the notification id of a notification just generated.
    We tried creating a suspended activity with a delay but it only works randomly. Sometimes the suspended update activity runs before the notification is generated and the update fails. Thanks, Tom

    Well, you could do a select in WF_NOTIFICATIONS and check if you application table is updated.
    select NOTIFICATION_ID from WF_NOTIFICATIONS where MESSAGE_TYPE like 'item type name'
    But as you noticied, notification id is not created immediately.
    Hope could help.
    Regards,
    Luiz

  • How to integrate SQL table with the cahce

    Hi,
    In normal ASP.net application we use the
    sqlCacheDependency to integrate the SQL server with the cache in ASP.NET, so that any change in the SQL table row will replace the cache with the latest data.
    How to achieve the same in the Azure cache.
    We need to integrate the SQL server with the Azure cache so that any change in the SQL table row should replace the cache with the latest data.

    Hi,
    Cache in Azure is not different with ASP.NET, please see
    http://msdn.microsoft.com/en-us/library/windowsazure/gg278356.aspx for more details, Azure provides for multiple types of persistent storage which can be leveraged for caching (Azure SQL Database, Azure Table Storage, Azure Blob Storage etc…). I would suggest
    you read this article (http://www.dnnsoftware.com/blog/cid/425642/Understanding-Windows-Azure-Caching-for-building-high-performance-Websites
    ), because of we know where the cache data is, so we can sync up the data as expected.
    Best Regards
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to update a table with strin that contains &

    Hi,
    I would like to update ename col of emp table with a string that contains &
    update emp set ename = 'tom&jerry' where empno = 7369But this gives an error.Please advice.
    Regards,

    Consult the sql*plus reference manual on how to disable the &
    Software engineers should be capable of doing research themselves, please stop abusing this forum to increase your salary by being spoon fed for free.
    Sybrand Bakker
    Senior Oracle DBA

  • Updating DB tables with the help of VC

    Hello all,
    I'm interested in building input forms and saving the data in the portal.
    I mean, that we are building DB tables in the portal and then, I'm going to build forms for data input/update for the users. Can I implement VC for this purpose?
    I know that VC is perfect for all type of outputs and, also, for connection to R3 functions, but I need something else. I need to store the data in DB tables in the portal. Is it possible to do it with VC?
    Regards,
    Inna

    Hello Inna,
    Your first question was.
    "I'm going to build forms for data input/update for the users. Can I implement VC for this purpose?"
    The answer is yes you can in the Visual Composer create forms that allow you to input data and update information. There is an excellent How To regarding this:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/2bd0e7bf-0201-0010-babb-bf5a28080184
    Your second question:
    "I know that VC is perfect for all type of outputs and, also, for connection to R3 functions, but I need something else. I need to store the data in DB tables in the portal. Is it possible to do it with VC?"
    By this I assume you wish to persist data in the portal itself? Is that correct? If this is correct, Visual Composer currently does not provide a way to persist data within the Enterprise Portal to my understanding.
    I hope this helps.
    Cheers,
    Scott

  • How to Update EKPO table with enhancement at header level-customer data tab

    Experts,
    I have a requirement where I had to create a new button in the 'customer data' tab(header) in the ME21N/ME22N Transaction and once it gets clicked a table control will appear and in that all the line items with item no, material and plant and an additional check box will display, and once any one checks the check box against the item/material in the table control the item data with additional z fields (already created the zfields in EKPO Table) should get updated.
    Displaying Table control and item data on the click of button was successful, but once you check the check box against the item and save the PO it is not updating the z-fields in the EKPO table.
    I have implemented all the user exits , badis but no results. 
    Once you check the box in the table control against each item in the header part (Table control is in header part (customer tab)) the line item EKPO table with z fields should get updated.
    Any Clues/ideas will be appreciated.
    Thanks in advance,
    Kalikonda.

    Hi,
    Can you please share the remedy for above issue, recently we have same issue in our system.
    or please send me any supportive doc. for the below mail
    Looking forward for your positive response.
    Thanks
    Mohan
    ([email protected])

  • How to update a table with huge data

    Hi,
    I have a scenario where I need to update tables that are having huge data (each table is having more than 10,00000)
    I am writing this update in PLSQL block.
    Is there any way to improve the performance of this update statement? Please suggest...
    Thanks.

    user10403630 wrote:
    I am storing all tables and columns that needs to be updated in tab_list and forming a dynamic qry.
    for i in (select * from tab_list)
    loop
    v_qry := 'update '||i.table_name||' set '|| i.column_name ' = '''||new_value||'''' ||' where '||i.column_name = ''||old_value||'''';
    execute immediate v_qry;
    end loop;Sorry to say so but this code is aweful!
    Well the only thing to make this even more slow would be to add a commit inside the loop.
    Some advices. But I'm not sure which one works in your case.
    The fastest way to update a million rows is: write a single update statement. On typical systems this should only run for like a couple of minutes.
    if you need to update several tables then write a single update for each table.
    If you have different values that need to be updated then find a way how to consider those different values in a single update or merge statement. Either by joining another table or by using some in-lists.
    e.g.
    update myTable
    set mycolumn = decode(mycolumn
                                     ,'oldValue1','newvalue1'
                                     ,'oldValue2','newvalue2'
                                     ,'oldValue3','newvalue3')
    where mycolumn in ('oldValue1','oldvalue2','oldvalue3'....);If you need to do this in pl/sql then
    1) use bind variables to avoid hard parsing the same statement again and again
    2) use bulk binding to avoid pl/sql context switches

  • How to update Nested tables with xsu

    Hello,
    I have three tables.
    1) DEPARTMENT_TAB
    2) EMPLOYEE_TYP
    3) ADDRESS_TYP
    ADDRESS_TYP is a collection and it is nested inside EMPLOYEE_TYP.
    EMPLOYEE_TYP is a collection and it is nested inside DEPARTMENT_TAB.
    created with below scropt
    CREATE TYPE ADDRESS_TYP AS OBJECT (CITY VARCHAR2(10), STATE VARCHAR2(2));
    CREATE TYPE ADDRESS_TYP_NT AS TABLE OF ADDRESS_TYP;
    CREATE TYPE EMPLOYEE_TYP AS OBJECT (EMPNO NUMBER(4), ENAME VARCHAR2(10), ADDRESS_VAR ADDRESS_TYP_NT);
    CREATE TYPE EMPLOYEE_TYP_NT AS TABLE OF EMPLOYEE_TYP;
    CREATE TABLE DEPARTMENT_TAB (DEPTNO NUMBER(4), DNAME VARCHAR2(10), EMPLOYEE_VAR EMPLOYEE_TYP_NT)
         NESTED TABLE EMPLOYEE_VAR STORE AS EMPLOYEE_TAB
         ( NESTED TABLE ADDRESS_VAR STORE AS ADDRESS_TAB);
    I inserted two rows in DEPARTMENT_TAB and their nested tables using normalsql. and i generated below xml content using XSU java API
    oracle.xml.sql.query.OracleXMLQuery
    My Question is How to UPDATE a row in ADDRESS_TAB using XSU java API
    oracle.xml.sql.dml.OracleXMLSave.
    (When i was trying to update address_tab nested table's row with xml input file. it is deleting other existing rows)
    Thanks.

    Why do you say it does not work?

  • HT4053 i want to know how to update my 4s with the ios7

    I need help upgrading my iPhone 4s to ios7.

    See the chart below to determine whether you can upgrade your device and what you can upgrade to. If you do not have a Software Update option present on your iDevice, then you are trying to upgrade to iOS 5 or higher. You will have to connect your device to your computer and open iTunes in order to upgrade.
    IPhone, iPod Touch, and iPad iOS Compatibility Chart
         Device                                       iOS Verson
    iPhone 1                                      iOS 3.1.3
    iPhone 3G                                   iOS 4.2.1
    iPhone 3GS                                 iOS 6.1.x
    iPhone 4                                      iOS 7.0.x
    iPhone 4S                                    iOS 7.0.x
    iPhone 5                                      iOS 7.0.x
    iPhone 5c                                     iOS 7.0.x
    iPhone 5s                                     iOS 7.0.x
    iPod Touch 1                               iOS 3.1.3
    iPod Touch 2                               iOS 4.2.1
    iPod Touch 3                               iOS 5.1.1
    iPod Touch 4                               iOS 6.1.x
    iPod Touch 5                               iOS 7.0.x
    iPad 1                                          iOS 5.1.1
    iPad 2                                          iOS 7.0.x
    iPad 3                                          iOS 7.0.x
    iPad 4                                          iOS 7.0.x
    iPad Mini                                      iOS 7.0.x
    iPad Air                                        iOS 7.0.x
    =====================================
    Select the method most appropriate for your situation.
    Upgrading iOS
       1. How to update your iPhone, iPad, or iPod Touch
       2. iPhone Support
       3. iPod Touch Support
       4. iPad Support
         a. Updating Your iOS from iOS 5
              Tap Settings > General > Software Update
         If an update is available there will be an active Update button. If you are current,
         then you will see a gray screen with a message saying your are up to date.
         b. If you are still using iOS 4 — Updating your device to iOS 5 or later.
         c. Resolving update problems
            1. iOS - Unable to update or restore
            2. iOS- Resolving update and restore alert messages

  • How to update database table with key field?

    Hello Experts,
    I have a database table with following fields
    MATNR   - Key
    SSOUR  -  Key
    KUNNR   - Key
    MENG1 
    MENG2
    MENG3
    And this table contains records like...
    MSD50001     R      1000001     5.30    2.30    5.25
    MSD50002     R      1000002     5.30    2.30    5.25
    MSD50003     R      1000003     5.30    2.30    5.25
    MSD50005     R      1000004     5.30    2.30    5.25
    MSD50004     R      1000005     5.30    2.30    5.25
    I have an internal table with same fields of above database table.
    MSD50001     A      1000001     5.30    2.30    5.25
    MSD50002     A      1000002     5.30    2.30    5.25
    MSD50003     A      1000003     5.30    2.30    5.25
    MSD50005     A      1000004     5.30    2.30    5.25
    MSD50004     A      1000005     5.30    2.30    5.25
    MSD50006     A      1000006     5.30    2.30    5.25
    I want to update the DB table with following internal table records.
    If internal table records = db table records are same then Update....else insert from internal table to db table.
    But here, SSOUR is key field so i am not able to use
    MODIFY dbtab from itab.
    It results me , entries in internal table are inserted into db table.
    So i have double records.
    Is there any statement which updates the key field? and if no fields in db table then insert it?
    Regards
    RH

    hi,
    u cannot update akey field.u can update only non key fields by using key field as a selection criteria.For example if u go to sm30 if u enter any table for inserting values, the key field will always be greyed out it is not succumbed to chnges.but u can insert value into ,if ur inserting and in the insert staemnet if  u have key field which is already present in the table it will return sy-subrc = 4 otherwise it will insert the record and return 0.
    eg for update :
    UPDATE zdm_wtyprof  SET upload_status = 'S'
                             WHERE spart = wa_upd-spart.
    here spart is the key field and it will update the status field in the table as S.
    if updated succesfully it will return 0.
    SIMILARLY U CAN USE select.

  • How to use nested tables with the inner table in a separate row

    Hi,
    I am having a problem when changing our existing Adobe printform delivery note so that serial numbers are written for each item line.
    I've searched the forum and found many posts relating to nested tables, but none that had exactly my situation.
    Currently I print item lines like this (this uses the complete width of the form):
    Pos....Quantity...Material..........Description..................................................Date
    99.........99.........ABCDEFGH....alksdalksjdlkasjdlsajdlkjasldjaslkdjakslj........9999.99.99
    .................................................fskdjflsdfljsdflkjsdlkfjsdlkjfdfsf
    .................................................asdkadsfdkfhsdkfhskjdfhks
    but I want to add serial numbers after that for each item like this:
    Pos....Quantity...Material..........Description...................................................Date
    99.........99.........ABCDEFGH....alksdalksjdlkasjdlsajdlkjasldjaslkdjakslj.........9999.99.99
    .................................................fskdjflsdfljsdflkjsdlkfjsdlkjfdfsf
    .................................................asdkadsfdkfhsdkfhskjdfhks
    .................................................Serial numbers:
    .................................................9999999999..9999999999..9999999999
    .................................................9999999999..9999999999..9999999999
    I have added serial numbers to my the current table in the interface/context/data view so it look like this:
    TTYP - ITEM_FIELDS
    ...DATA structure
    ......POSNR
    ......QTY
    ......MATNR
    ......TTYP - ITEM_TEXTS
    .........DATA structure
    ............DESCRIPTION
    ......DATE
    ......TTYP - SERIAL_NOS
    .........DATA structure
    ............SERIAL_COL1
    ............SERIAL_COL2
    ............SERIAL_COL3
    In my Hierarchy I currently have this hierarchy and binding:
    Table - ITEM_FIELDS
    ...Body Row - DATA
    ......Cell - POSNR
    ......Cell - QTY
    ......Cell - MATNR
    ......Subform - ItemTexts
    .........Table - ITEM_TEXTS
    ............Body Row - DATA
    ...............Cell - DESCRIPTION
    ......Cell - DATE
    Now I am trying to add the SERIAL_NOS table into the ITEM_FIELDS/DATA body row right after the DATE cell - but I am not allowed to drag anything into the table structure.
    Does anybody have an ida how I can achieve this, please?
    Kind regards,
    Claus Christensen

    HI,
          Set the body page as flowed and set the tables also flowed.
    go to bodypage>object->subform-->select flowed option.
    I thihnk this will work..if u are getting all the records properly into the tables 1 and 2.
    Thanks,
    Mahdukar

  • How to update a table with if condition

    here is my table 
    Party1 party2 DELFlag
    JON     NYC     0
    JON     NYC1   0 
    SAM     NYC   0
    SAM    NYC1   0
    TOM     NYC1   0
    GIT      NYC1   0
    No I need to change all NYC1 to NYC , but I get primary key error As JON is already related to JON->NYC  in this case I need to make the flag to 1 
    To be more specific JON->NYC1 must be JON-NYC1-1 and TOM-NYC1-0 must change to TOM-NYC-0 as tom does not have any records 
    My table update must look like 
    Party1 party2 DELFlag
    JON     NYC     0
    JON     NYC1   1
    SAM     NYC   0
    SAM    NYC1   1
    TOM     NYC   0
    GIT      NYC   0

    I can't use this INSERT INTO @partyRock (Party1, Party2, DELFLag) VALUES my table has thousands of rows and other relations even 
    Dont want to create a new table as this is in all my prod servers , want to update 
    Party1 party2 DELFlag
    JON     NYC     0
    JON     NYC1   0 
    SAM     NYC   0
    SAM    NYC1   0
    TOM     NYC1   0
    GIT      NYC1   0
    SDS      ORD 0
    DED      MEX  0
    Update output table
    Party1 party2 DELFlag
    JON     NYC     0
    JON     NYC1   1
    SAM     NYC   0
    SAM    NYC1   1
    TOM     NYC   0
    GIT      NYC   0
    SDS      ORD 0
    DED      MEX  0

  • How to update Z table with delivery number using MV50AFZ1

    Hi Friends,
    I am working with user exit MV50AFZ1/ USEREXIT_SAVE_DOCUMENT.
    My requirement is I have a Ztable with delivery number field (initially blank). If I create a delivery thru sales order VA02 , my created delivery number should get populated/updated in my Ztable.
    I would appreciate if someone could help me on this.
    Thanks.

    Hi
    First of all, read SAP Note 415716 - User exits in delivery processing, as for instance, avoid your own COMMIT WORK.
    For instance, as the sample code suggests, the better is encapsulate your ABAP coding in a function module with the option IN UPDATE TASK. Define the interface with the data that you need (XLIKP, XLIPS, XVBUK, and so on), after in your own coding (for instance)
    FUNCTION Z_SAVE_DELIVERY
         IMPORTING
           VALUE(IM_LIKP) TYPE SHP_LIKP_T.
       DATA: w_zeta LIKE z_table.
       DATA: ty_likp TYPE likp.
      LOOP AT im_likp INTO ty_likp.
         MOVE-CORRESPONDING ty_likp TO w_zeta.
         MODIFY z_table FROM w_zeta.            "or your own algorithm, searching records and modify them.
      ENDLOOP.
    In the userexit you can do this coding:
      CALL FUNCTION 'Z_SAVE_DELIVERY' IN UPDATE TASK
          EXPORTING
                im_likp = xlikp.
    I hope this helps you
    Regards
    Eduardo
    Edited by: E_Hinojosa on Jun 21, 2011 5:49 PM

Maybe you are looking for

  • Zen Vision M (30gb) - as Unknown Device??

    Hi all, I had a problem this morning when I plugged in my Zen Vision M to my computer this morning. Normally when the player plugs in, the screen shows that it's docked. But today, instead of showing the 'docked' screen, it displays the menu when the

  • Cloning ebs r12 on 11gR2 database

    Hi all, our ebs r12 12.1.3 and db 11..2.0.2 OS:oul5x64 from ebs r12 12.1.3 and db 11.1.0.7 i do not have any problems with cloning, but when upgrade database to 11.2.0.2 . the template file was different and the clone failed because it could not fine

  • URgent (Difference b/w ECC5.0 and ECC 6.0

    HELLO ALL!!! CAN ANYBODY TEL ME WHAT IS THE DIFFERENCE B/W ECC5.0 AND ECC6.0 IN CONTEXT OF TECHNOLOGY (ABAP) WARM REGARDS, SUDHA

  • FF.5 Problem

    Hi All Our current scenario bank statement gendered each and every day and we are uploading the bank statement with same format by using transaction code FF.5 . We are trying to upload the bank statement on weekly basis with same format and same bank

  • When is the ios 5 coming out will it be in august

    When is the ios 5 coming out and will it be in August