How to update a column value by comparing old value by using DML Handler...

Hi Can anyone post the DML Handler code for updating a column value by comparing the old value.
Thanks,
Ray

Hi,
Here is an example of a DML handler.
BEGIN
DBMS_APPLY_ADM.SET_DML_HANDLER(
object_name => 'scott.emp',
object_type => 'TABLE',
operation_name => 'UPDATE',
error_handler => false,
user_procedure => 'strmadmin.update_column',
apply_database_link => NULL,
apply_name => 'MY_APPLY');
END;
This DML handler which will send any LCR matching the specified conditions to the strmadmin.update_column for customised processing.
You can write the strmadmin.update_column procedure so that it extracts the old values from the LCR. You can then use the old values from the LCR to identify the row in the table. Once you identify the row, you can update it as you want.
I haven't really tried to do any customised processing using DML handlers, but this should work.
Hope this is of help.
Sujoy

Similar Messages

  • How to update table J_1IPART1,without replacing the old values

    Helllo Friends
    Problem:
    When I capture the  excisable document in T-code J1IEX, the table J_1IPART1 does not  get updated ,but when I do the good receipts by 101,then entry in the above table get updated ,by replacing the  previous entry.
    What should I do so that table J_1IPART2 hold all the captured values without replacing the old values.
    And after what time of interval do I need to update the register, is it on daily bases or on monthly bases

    Try these steps:
    1. Post MIGO without excise entry
    2. J1I5 - Update register for RG23A Part1 with classification ROP.
    3. Post excise Invoice through J1IEX
    You should update the register on daily basis.

  • How to update two columns in two tables?

    hi friends
    I have two tables linked to each other through SaleNo and SaleDT. their structure as below
    Sales Table============
    SaleNo int PK auto increment
    SaleDT Datetime PK
    Qnty decimal
    Units decimal
    Invoices table
    =================InvoiceNo int PK Auto incremented
    InvoiceDT Datetime
    SaleNo int FK
    SaleDT Datetime FK
    Note that SaleDT column is NOT assigned with getDate() expression.
    1. what I need to do is update the SaleDT column of Sales table and Invoices table with the value '2013-01-31 10:31:55.813', how do I do this without manually breaking the link between the tables?
    2. Assume SaleNos 15 to 27 needs update the SaleDT to '2013-06-12 10:31:55.813', how do I do this complex operation where I I have update SaleDt column of two table of SaleNo range from 15 to 27?
    thanks
    I use Visual studio 2012 Ultimate and SQL server 2008 developer edition!

    Why not below? May be you will not be able to change your design now, but just want to share.
    Sales Table============
    SALEID int PK autoincrement
    SaleNo int
    SaleDT Datetime
    Qnty decimal
    Units decimalUNIQUE (Saleno,SaleDT)
    Invoices table
    =================InvoiceNo int PK Auto incremented
    InvoiceDT Datetime
    SALEID int FK

  • How to update a column in a nested table for a given record in the master t

    Hi I have translations for all attributes of an item stored as a nested table
    CREATE OR REPLACE TYPE T_ITM_ATTR AS OBJECT(
    ATTR_NM VARCHAR2(30),
    ATTR_VAL VARCHAR2(200 CHAR),
    ATTR_STS_BL NUMBER(1))
    INSTANTIABLE
    FINAL
    CREATE OR REPLACE TYPE T_ITM_ATTRIBUTES AS TABLE OF T_ITM_ATTR;
    CREATE TABLE XGN_MOD_ITEMS_T
    IDS NUMBER,
    MOD_IDS NUMBER NOT NULL,
    MOD_ITM_IDS NUMBER NOT NULL,
    LGG_ID VARCHAR2(3 CHAR) NOT NULL,
    ITM_TYPE VARCHAR2(50 CHAR) NOT NULL,
    ITM_NM VARCHAR2(50 CHAR) NOT NULL,
    ITM_BLOCK VARCHAR2(50 CHAR),
    ITM_ATTR T_ITM_ATTRIBUTES,
    ITM_COL1 VARCHAR2(1 CHAR),
    ITM_DSC VARCHAR2(100 CHAR),
    CREATED_BY VARCHAR2(30 CHAR) DEFAULT USER NOT NULL,
    CREATION_DATE DATE DEFAULT SYSDATE NOT NULL,
    LAST_UPDATED_BY VARCHAR2(30 CHAR),
    LAST_UPDATE_DATE DATE
    NESTED TABLE ITM_ATTR STORE AS NESTED_ITM_ATTR_T
    TABLESPACE XGN4_TAB
    PCTUSED 40
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    What I want to do is to update only the attr_val of each item to a value coming from a temporary table where the user inserted his translations
    So how can I update ?
    this doesn't work since I have to know the previous value?
    update table(
    select t2.attr_val
    from XGN_MOD_ITEMS_T t1, table(t1.itm_attr) t2
    where t1.mod_itm_ids=160) attr
    set value(attr) = 'Profil'
    where value(attr) = 'Profile'
    This updates all occurences for all entries wich doesn't work either because I have for each language another record
    UPDATE /*+ NESTED_TABLE_GET_REFS */
    NESTED_ITM_ATTR_T
    SET attr_val = 'SHIT'
    WHERE attr_val = 'Profile'

    http://www.psoug.org/reference/nested_tab.html
    Look for UPDATE. There is a working demo on the page.
    That said nested tables are not a good place to store data. Reconsider using relational tables with, if necessary, object views.

  • How to update a column with default in a tabular form.

    We have a tabular form that has a submit button that does a multi row update. We would like to update a column with a defaut like APP_USER = updated user when the row is updated. Is this possible and how?

    used lovs and conditions.

  • How to update specified column in table?

    Hi,there,
    I'm green in oracle,I have 2 tables with the same
    fields, the same structure, I call it Ta and Tb,here
    is their structure:
    Ta:
    Name Type
    ================
    Col1 Varchar2(10)
    Col2 Varchar2(10)
    Col3 Varchar2(10)
    Tb:
    Name Type
    ========================
    Col1 Varchar2(10)
    Col2 Varchar2(10)
    Col3 Varchar2(10)
    Here is their Data:
    Ta:
    Col1 Col2 Col3
    ========================
    c11 c31
    c12 c32
    c13 c33
    Tb:
    Col1 Col2 Col3
    ========================
    c11 c21 c31
    c12 c22 c32
    c13 c23 c33
    so how can I copy the contents of Col2 of Tb into
    col2 of Ta using SQL or PL/SQL? I mean I want to
    fill col2 of Ta with the data of col2 of Tb,pls
    help me,thanks in advance!
    NewOra

    Here is the query
    update Ta set Ta.col2 = (select Tb.col2 from Tb where Ta.col1 = Tb.col1 and Ta.col3 = Tb.col3)
    if u have the primary key columns is the tables u dont need to incolude all the columns in the where clause, u can use only key columns.

  • How to update clobDomain column

    Hi
    We have following requirement.we have stored the xml data in clob field in the data base.we want to read that data into Document type(org.w3c.dom.Document) and add few new elements to the document and update the data back in the database.we have used the below code.
    public void getPedigreeDocRec(Long pedigreeDocId ) throws Exception {
    PedigreeDocumentVOImpl pedigreeDocumentRowSet = getPedigreeDocument();
    String[] vcNames =
    { "byPedigreeDocumentId" };
    ((ViewCriteriaManager) pedigreeDocumentRowSet.getViewObject()).setApplyViewCriteriaNames(vcNames);
    ((PedigreeDocumentVOImpl) pedigreeDocumentRowSet.getViewObject()).setbindPedigreeDocumentId(pedigreeDocId);
    pedigreeDocumentRowSet.executeQuery();
    if(pedigreeDocumentRowSet != null) {
    while (pedigreeDocumentRowSet.hasNext())
    Row pedigreeDocumentRow = pedigreeDocumentRowSet.next();
    ClobDomain pedigreeXML = (ClobDomain) pedigreeDocumentRow.getAttribute("PedigreeDocument");
    DocumentBuilderFactory docBuildFactory= DocumentBuilderFactory.newInstance();
    Document containerDoc = docBuildFactory.newDocumentBuilder().newDocument();
    Node node= pedigreeXML..getXMLContentNode(containerDoc);
    Element newChild = containerDoc.createElement("newNode");
    node.appendChild(newChild); // i am getting error here " node type cannot be appended to node of type CDATA
    String str =node.getTextContent();
              this.getDBTransaction.commit();
    Can you please let me know how can we achieve above requirement.
    Thanks
    Baji

    I guess that getXMLContentNode() is primarily intended for ADF internal activation/passivation of the value of the ClobDomain object. That's why it always returns the whole CLOB content as a one CDATA section.
    You need would need to get the content of the ClobDomain object, parse it into an XMLDocument, then modify that document by adding nodes at the appropriate place, then write back to the ClobDomain object.
    Sascha

  • How to update a column using hibernate

    how to update a particular column using hibernate..
    iam using oracle database

    I think you didn't get the point. This is a generic Java forum... not a Hibernate forum.

  • How to update a column which has 35 millions of rows?

    Hi everyone
    need help
    I am updating a column which has 35 millions of records. When i start update, it is taking like > 60 mins and its not stoping (finishing).
    I need to null that column A, and update that column A  with the other column B values.
    Thanks
    kumar

    Three common causes for big updates that are slow:
    blocking. You can check whether the UPDATE is waiting on another connection to release locks using sp_who2
    improperly sized log file. A big update may use of a lot of log space. If you log file is too small, and you have auto-grow enabled (which is the default setting), it will grow whenever needed. But this takes a lot of extra time. You can easily see this
    when you view the file size of the log file
    if the column you are updating is indexed, the engine may also you tempdb a lot, so tempdb may also grow a lot, which would take a lot of additional time. This is also easy to check by inspecting tempdb's file size
    Gert-Jan

  • How tu update a column having type 'Long raw' in oracle table with an image

    Hello,
    I must change the image loading in a column with 'long raw' type in the table. I find an image data already in the table.
    I have my new imgae in a file .bmp.
    What SQL instruction I mut use to update this column to load my new image ?
    I work in Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod.
    thanks for your helps.
    Regards.

    Unless I'm missing something MSFT are making it unecessarily complex by not implementing the SQL/XML standard...
    SQL> alter table emp add ( emp_xml xmltype)
      2  /
    Table altered.
    SQL> update emp set emp_xml = XMLELEMENT("EMPLOYEE",xmlattributes(EMPNO as "id"), XMLElement("Name",ENAME))
      2
    SQL> /
    14 rows updated.
    SQL> set pages 0
    SQL> select EMPNO, EMP_XML from EMP
      2  /
          7369
    <EMPLOYEE id="7369">
      <Name>SMITH</Name>
    </EMPLOYEE>
          7499
    <EMPLOYEE id="7499">
      <Name>ALLEN</Name>
    </EMPLOYEE>
          7521
    <EMPLOYEE id="7521">
      <Name>WARD</Name>
    </EMPLOYEE>
          7566
    <EMPLOYEE id="7566">
      <Name>JONES</Name>
    </EMPLOYEE>
          7654
    <EMPLOYEE id="7654">
      <Name>MARTIN</Name>
    </EMPLOYEE>
          7698
    <EMPLOYEE id="7698">
      <Name>BLAKE</Name>
    </EMPLOYEE>
          7782
    <EMPLOYEE id="7782">
      <Name>CLARK</Name>
    </EMPLOYEE>
          7788
    <EMPLOYEE id="7788">
      <Name>SCOTT</Name>
    </EMPLOYEE>
          7839
    <EMPLOYEE id="7839">
      <Name>KING</Name>
    </EMPLOYEE>
          7844
    <EMPLOYEE id="7844">
      <Name>TURNER</Name>
    </EMPLOYEE>
          7876
    <EMPLOYEE id="7876">
      <Name>ADAMS</Name>
    </EMPLOYEE>
          7900
    <EMPLOYEE id="7900">
      <Name>JAMES</Name>
    </EMPLOYEE>
          7902
    <EMPLOYEE id="7902">
      <Name>FORD</Name>
    </EMPLOYEE>
          7934
    <EMPLOYEE id="7934">
      <Name>MILLER</Name>
    </EMPLOYEE>
    14 rows selected.
    SQL>

  • How to update multiple columns from different tables using cursor.

    Hi,
    i have two tables test1 and test2. i want to udpate the column(DEPT_DSCR) of both the tables TEST1 and TEST2 using select for update and current of...using cursor.
    I have a code written as follows :
    DECLARE
    v_mydept1 TEST1.DEPT_CD%TYPE;
    v_mydept2 TEST2.DEPT_CD%TYPE;
    CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
    BEGIN
    OPEN C1;
         LOOP
              FETCH C1 INTO v_mydept1,v_mydept2;
              EXIT WHEN C1%NOTFOUND;
              UPDATE TEST2 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
              UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
         END LOOP;
         COMMIT;
    END;
    The above code when run says that it runs successfully. But it does not updates the desired columns[DEPT_DSCR].
    It only works when we want to update single or multiple columns of same table...i.e. by providing these columns after "FOR UPDATE OF"
    I am not sure what is the exact problem when we want to update multiple columns of different tables.
    Can anyone help me on this ?

    oops my mistake.....typo mistake...it should have been as follows --
    UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
    UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
    Now here is the upated PL/SQL code where we are trying to update columns of different tables --
    DECLARE
    v_mydept1 TEST1.DEPT_CD%TYPE;
    v_mydept2 TEST2.DEPT_CD%TYPE;
    CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
    BEGIN
    OPEN C1;
    LOOP
    FETCH C1 INTO v_mydept1,v_mydept2;
    EXIT WHEN C1%NOTFOUND;
    UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
    UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
    END LOOP;
    COMMIT;
    END;
    Please let us know why it is not updating by using using CURRENT OF

  • How can I modify column width in a spreadsheet report without using an Excel template

    I currently use the LabVIEW Report Generation toolkit in LabVIEW 2011SP1 to create simple spreadsheet reports that I can build/print without having Microsoft Office products installed.  I really like being able to do this, and it allows me to generate nice on-demand data reports - I'm also not tied to having Office installed on the system I'm using, so this works on just about any test fixture I can install the software on.  
    I recently have a requirement that I must have variable-length columns in my report.  I currently use the VI "Append Text Table to Report" in order to create a text table, but the column width requirement is that all columns must be equal width UNLESS I use an Excel Template file to define my column widths.  
    My questions are:
    Is it possible to create a text table and define per-column widths without using an Excel Template?  If so, how?  My report mainly has a lot of small numerical values for the columns, but some columns contain system names or status messages - I really hate the longer text blocks wrapping and taking up so much real-estate when if I could control the column widths I can get all my data on a single line.
    I'll admit I haven't tried this myself yet, but if I use an Excel Template will that require me to have Excel installed on the PC in order to print/generate reports?
    Is there a recommended way (with an example) of generating a text table in a report with or without using the "Append Text Table to Report" VI that allows me to have custom column widths that doesn't require me to manually build a custom print page?  If I do have to create a custom print page, what would be the most straightforward approach?
    Thanks!
    -Danny

    Sure, I'll provide a pared down example that demonstrates my use-case:
    I have a control to the VI that takes in a 2D array of strings representing the data I want printed in a table.  I am generating a standard report, adding a table to the report, and printing it.  The first VI is "New Report.vi", the second VI is "Append Table to Report.vi", and the third is "Print Report.vi", all found standard in the Report Generation palette.
    Note that the "Append Table to Report.vi" has an input parameter "Column Width" with a default value of (1).  This input parameter is a single input parameter, which defines the column widths of ALL the columns in my table - hence, with the VI the way it is, all my columns will be 1 inch wide.  
    I find myself needing to be able to define per-column widths, not just a single global column width parameter.  
    The only way I have found to do this is by using an Excel template file.  The "New Report.vi" takes in a "template" parameter, and if used, the report generation toolkit can be set to ignore the "Column Width" input parameter on the "Append Table to Report.vi" by setting the width value to -1.  Instead it will launch Excel, open the template file provided, build the table using the template, will close Excel, and will attach the generated table to the report.  However, I have a strict requirement that Microsoft Office NOT be required to be installed on the computer.  
    So, without using Excel, is there a way to generate a table in a report and define the width of each column individually?
    -Danny

  • Compare Old Value (Session State) with New Value on Submit.

    Hi all,
    Is there an easy way to do comparison of Old Value (Session State Value) with the New Value?
    is there an API for that? like what we have in PLSQL Trigger :NEW & :OLD
    Thanks before
    -Joel

    There is only one version of session state available for examination at any point during page rendering or processing, the current version. Can you explain more about what you need?
    Scott

  • How to Update some column values in some rows in an advanced table

    Hi Gurus,
    Can any body help on this issue.
    I am having a results table which is showing all the queried parties data queried in a seeded page in OCO module.
    Lets assume the table contains 10 rows with the below columns
    Party Name, Registry ID, Address Country, Match Percentage, Certification Level, Certification Reason, Internal Indicator, Status .
    Certification Level, Certification Reason and Internal Indicator are the dropdowns.
    The user want to update some of these fields values for some rows randomly.
    After doing this if he click on Save button, Only thosed changed rows need to get update using a Custom Procedure.
    But here all the rows irrespective of the change getting updated.
    So  how to capture the modified rows.
    Appreciate any inputs..
    Thanks
    Palepu
    Edited by: Palepu on 9 Aug, 2012 4:25 PM

    Not sure if you got the answer. You need to capture the row which got changed using the below and get the column value using the getAttribute method. This works for single selection row, if it is multi selection then you will have to loop through all selected rows and find the VO attribute value.
    String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    Row currentRow = am.findRowByRef(rowReference);
    String param1= (String)currentRow.getAttribute("VOAttribute");
    Let me know if there are any issues.
    Thanks
    Shree

  • How to update a column with different values but all other row values r sam

    Hi,
    I have a table like this.
    Col1 col2 col3 col4
    10 20 30
    10 20 30
    10 20 30
    i need to update col4 with different values coming from other table like this
    Col1 col2 col3 col4
    10 20 30 xxxx
    10 20 30 yyyy
    10 20 30 zzzz
    how can i update the table. pls let me know how to use the where condition in the update stmt.
    thanks,
    jay
    Edited by: user2558790 on Nov 20, 2009 12:26 PM

    what is the logic for this kind of update...????
    Greetings,
    Sim

Maybe you are looking for

  • Works when opened in Acrobat 9 but not in IE ?

    I'm trying to rewrite a plug-in that reads data from an external system using a COM component and it works just great when opened in Acrobat 9 pro, but when I open the pdf in Internet Explorer (on the same computer) I can see that the plugin is activ

  • Respectives G/L accounts not picking while making posting

    HI when i am making posting in FB60 and tick on calculate tax than it is not picking the respective G/L accounts , how to display the accounts because while posting it should automatically pick the accounts

  • Can't get my first Function to work!

    Hi everyone, I have been trying to make a function, but it won't compile without errors. I already checked the forum and other sites for an answer, but I can't seem to find one. So here's my function (I'm taking an integer value as an input and retur

  • Now what?

    Got my MBP about a month ago, and very glad that I did it (first time saw mac in front of me). Yesterday purchased LE7 and still waiting for it. I'm complete newbie here and my question is where do I start? Do I need anything else to buy, or install

  • C7: How to play .FLV files on Nokia C7

    Can I ask how do you play .FLV files on Nokia C7? I searched for FLV player in the Ovi Store and nothing is returned, whereas on Android Market loads of FLV players are available.