ADF Updating bindings for filtered rows in table

I have an ADF UIX table with say 10 rows each row having 8 fields. 2 of these are editable. So 6 fields use uix.current.fieldname and 2 editable use bindings.fieldname.
I have a drop down list on top of the table. Selecting an option fires an event which sets parameters in the view and filters the table and reduces the rows say to 4.
The table is now showing correct values for the non editable fields. But the editable fields are not showing the correct value. They show the older first four rows values.
How do I update the bindings when I reexecute the view for filtering the rows?
Appreciate your help.
Thanks,

There is absolutly no reason to use PL/SQL (e.g. nested cursors, logic etc.) use MERGE
MERGE INTO emp target
USING (SELECT emp.empno,emp.sal,dept.dname,
       CASE WHEN dept.dname ='ACCOUNTING'
         THEN TRUNC(emp.sal * 1.2) ELSE TRUNC(emp.sal * 1.1) END new_sal
        FROM emp
         INNER JOIN dept
         ON (emp.deptno = dept.deptno)
       )source
    ON (target.empno = source.empno)
  WHEN MATCHED THEN UPDATE
     SET target.sal = source.new_sal;And, if the factor of the update is stored in a special table / query, it gets even easier to maintain.
-- andy

Similar Messages

  • Update Button for every Row of Report

    hello,
    is it possible to get an update button for every row of a report?
    After clicking this button, only this row of the report should be updated.
    thanks in advance
    dave

    Create a hidden item on your page. Call it somehow - P1_KEY. Create other hidden fields
    for the rest of the columns you want to update. Create a link per report line. This link will be
    inserting the primary key of your record into P1_KEY and the other values you want to
    update in the other hidden fields. It will branch to the same page and contain a request - i.e. UPDATE_ROW. Then
    you create a process - On Load Before Header - which will
    take the value from your item P1_KEY and update the record
    in the database by setting the the column values to the
    values in your hidden fields. This process will fire upon
    request you specified. However, this way you will not be
    able to update your text areas, since you will not be able
    to transfer this over a link. Also you need to be carefull
    about special characters.
    Maybe there is a better proposal than this.
    Denes Kubicek

  • Create a Navigational Hierarchy for filtering with the Table API

    Hello,
    I've built a WAD report acourding to the how to document: "Create a Navigational Hierarchy for filtering with the Table API".
    It works great but i dont know How to make the hirarchey to show the key and the text.
    Please Advice.
    David

    Hi Kenneth,
    please have a look in the source of the executed Web Application. What is inside of the <div> with the id filter?
    You should also find a td tag with id hier_xyz with xyz the filter inside of the <div>-Tag with id filter.
    Also check whether you have a javascript error.
    Have a look on the Javascript function set_style. Perhaps you can paste it here, than I can have a look.
    Heike

  • How to use simple values services for multiple rows ina table

    Hi Frnds...
    As per my requirment i need to use SVS for multile rows in a table.
    The coding goes like this for getting single attribute which is directly under root context.
    objSimpleValueSetCurr = wdContext.getNodeInfo().getAttribute("ctx_attribute");
    (this is only for context attribute directly placed under root context in the view controller.)
    We need to use value node and a value attribute inside this node. And retrieve the same. so need help regarding the code changes.
    Regards,
    Sudeep

    Hi ,
    I had tried out your suggestion. Its not working.
    The code goes like this, but the data is not getting populated.
    "controller_curr" is the value attribute  under the node "InitTable" in the controller which is further mapped to view controller with the same structure.
    The data is geting printed through the message manager just before the line
    divSMT.put(currency,currency); in this code, at the end.
    But "divSMT.put" is not able to populate the data.
    _________START________
    public void currency( )
        //@@begin currency()
              IWDMessageManager msg = wdComponentAPI.getMessageManager();     
              ISimpleTypeModifiable objSimpleTypeCurr = null;
              IModifiableSimpleValueSet objSimpleValueSetCurr = null;
              String currency=null;
              String bandg = null;
              Z_Bapi_Get_Curr_Rate_Input authCurrDet = null; //for FCURR
        Try
    authCurrDet = new Z_Bapi_Get_Curr_Rate_Input();
                         wdContext.nodeZ_Bapi_Get_Curr_Rate_Input().bind(authCurrDet);
                              wdContext.nodeZ_Bapi_Get_Curr_Rate_Input().currentZ_Bapi_Get_Curr_Rate_InputElement().modelObject().execute();     
    IWDAttributeInfo  objSimpleValueSetCurr1 = wdContext.nodeInitTable().getNodeInfo().getAttribute("controller_curr");
    ISimpleTypeModifiable countryType = objSimpleValueSetCurr1.getModifiableSimpleType();
    IModifiableSimpleValueSet divSMT = countryType.getSVServices().getModifiableSimpleValueSet();
    int sizeofCurrencyFCURR = wdContext.nodeOPCURROutput().nodeIt_Curr_Rate().size();
    msg.reportSuccess("SizeofCurrency FCURR : "+sizeofCurrencyFCURR);
    for(int i=0;i<sizeofCurrencyFCURR;i++)
    currency = wdContext.nodeOPCURROutput().nodeIt_Curr_Rate().getIt_Curr_RateElementAt(i).getFcurr();
    msg.reportSuccess("Currency : "+currency);
    divSMT.put(currency,currency);
         catch(Exception e)
    //@@end
    _________END________
    Please look into the issue.
    Regards.

  • Check for a row in table control

    I have a table control and on a click of a row in a particular column (vertically downwards) i want to check which row of that column is clicked because i want search help of that column different for every row.
    how can i do it

    hi,
    In the struicture having the table control fields add a field 'sel type c.
    In the screen in table control consider single line selection and enter field name as sel. activate the screen layout.
    In PAI,
    loop atthe table control table and read the row where sel = 'X'.
    Now write your serach help code for the corresponding column and row.
    Thanks,
    Kasiraman R

  • Error after using a servlet in ADF  - unable to select another row in table

    Hello,
    I have a go button and when I select a row in a table it call a download servlet. After I open or save the document I'm unable to make other selection in the table or make another action.
    The table has single row selection active.
    The servlet make part from a task-flow.
    Here is the code for the sevlet and my jdev version is 11.1.1.2.0
    public class DownloadServlet extends HttpServlet {
    @Override
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    public void doGet(HttpServletRequest request,
    HttpServletResponse response) throws ServletException,
    IOException {
    String id= null;
    String den= null;
    InitialContext ic;
    try {
    ic = new InitialContext();
    } catch (NamingException e) {
    DataSource ds = null;
    Connection conn = null;
    PreparedStatement cStmt = null;
    ResultSet rset= null;
    byte[] bdata = null;
    String rezult_null = "";
    id_fisier_lcl = request.getParameter("id");
    den_fisier_lcl = request.getParameter("fileName");
    rezult_null = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
    "<Body>Fisierul a fost arhivat</Body>";
    try {
    ic = new InitialContext();
    ds = (DataSource)ic.lookup("jdbc/ConnDS");
    conn = ds.getConnection();
    cStmt = conn.prepareStatement("commit");
    cStmt.execute();
    conn.commit();
    cStmt= conn.prepareStatement("SELECT a.item FROM table a WHERE a.id = " + id);
    rset = cStmt.executeQuery();
    if (rset.next()) {
    weblogic.jdbc.wrapper.Clob clob =
    (weblogic.jdbc.wrapper.Clob)rset.getClob("content");
    oracle.sql.CLOB oclob = (oracle.sql.CLOB)clob.getVendorObj();
    bdata = new byte[(int)oclob.length()];
    InputStream is = oclob.getAsciiStream();
    is.read(bdata);
    rset.close();
    cStmt.close();
    } else {
    bdata = new byte[(int)rezult_null.length()];
    bdata = rezult_null.getBytes();
    rset.close();
    cStmt.close();
    } catch (NamingException e) {
    } catch (SQLException e) {
    String username_lcl = null;
    username_lcl =
    ADFContext.getCurrent().getSecurityContext().getUserName();
    OutputStream outputStream =response.getOutputStream();
    String mimetype = "";
    FacesContext facesContext =FacesContext.getCurrentInstance();
    response.setContentType( (mimetype != null) ? mimetype : "application/x-download" );
    response.setHeader( "Content-Disposition", "attachment; filename=\"" + den_fisier_lcl + ".xml\"" );
    try {
    outputStream.write(bdata);
    outputStream.flush();
    outputStream.close();
    catch (Exception e) {
    e.printStackTrace();
    FacesMessage msg =
    new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(),
    facesContext.addMessage(null, msg);
    How can I fix it?
    Thank you.

    Hi,
    have you seen this ?
    http://download.oracle.com/docs/cd/E21764_01/apirefs.1111/e12419/tagdoc/af_fileDownloadActionListener.html
    If you want to continue with your approach, then a way out of your problem could be to add an af:clientListener onto the command button. The JavaScript function would be
    function onDownload(evt){
      evt.noResponseExpected();
    }Frank

  • Default value for first row in table after row has rendered

    I have a master-detail type page where the first row in the detail table appears with no values when the page first renders. After the user enters some data in the master area, the default value is available. I then use something like this to set the default in one column of the first row:
    MyVOImpl vo = (MyVOImpl)am.getMyVO1();
    MyRowImpl voRow = (MyRowImpl)vo.first();
    voRow.setMyAttribute("some value");
    When I do this and run the code in the debugger, I can see that the default value is stored somewhere in the row object. However, the value is not displayed in the screen.
    What must I do to get the default value to display after the user has tabbed out of the master data area, and before the user attempts to enter data in the row?

    Hi. Thanks again.
    Here is more detail of the code:
    if (pageContext.isLovEvent())
    * Form was submitted because the user selected
    * a value from the LOV modal window,
    * or because the user tabbed out of the LOV input.
    * This code executes when the event is either
    * LOV_UPDATE or LOV_VALIDATE
    String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM)
    // Find out the result values of the LOV.
    Hashtable lovResults =
    pageContext.getLovResultsFromSession(lovInputSourceId);
    // Find out which LOV input triggered the event.
    if (lovInputSourceId.equals("myLovItemId"))
    String myDefaultVar = null;
    if (lovResults != null)
    myDefaultVar = "some stuff " + (String)lovResults.get("myResultItemId")
    if (myDefaultVar != null && myDefaultVar != "") // yes, this is always true in this case
    // now set the default for the first line.
    // Added lines will be defaulted by the
    // EO.create() method.
    MyVOImpl myVo = (MyVOImpl)am.getMyVO1();
    MyVORowImpl myVoRow = (MyVORowImpl)myVo.first();
    myVoRow.setAttribute("myRowItemId", myDefaultVar); // THIS LINE DOES NOT CAUSE DISPLAY TO CHANGE
    The problem, as noted in the code, is that setAtrribute() does not cause the default value to display in the field.
    What can cause this, and what can fix it?
    Edited by: user522137 on Nov 9, 2010 12:06 PM

  • Change delete link href for each row of table

    Hi,
    I am using Struts/JSP to do the following..
    iterate through a list of bean objects and show them as table rows. I can do this successfully. I'm using logic:iterate tags to iterate and bean:write tags to write to table columns.
    I have a delete link added to each row.. which is configured as follows..
    <logic:iterate..... >
    <tr>
    <bean:define  id="rowId" name="form" property="bean"/>
    <td><a href="order.do?action=delete&orderid=<%=rowId%>">Delete</a></td>
    </tr>
    </logic:iterate>I'm trying to investigate if there are other ways to do this instead of using
    "<%=rowId%>"...
    Any suggestions?
    Thanks

    Hi,
    Check the event "EH_ONONE_CLICK_ACTION " line 58/59 it calls 'Relationships' window's outbound plug 'ToAccountRelationshipsEF'
    lr_window = me->view_manager->get_window_controller( ).
       lr_window->call_outbound_plug( 'ToAccountRelationshipsEF' ).
    keep breakpoint in the outbound plug, you can see the navigation details it could be done using nblinks/tlinks or by calling the navigation link of parent component bp_head/overview..
    Similarly EH_ONNEW event will get trigger when you click on new button and it allows to open the view in editable mode, again this is calling the same outbound plug ToAccountRelationshipsEF'.. looks like there could be dynamic navigation happening with the same outbound plug, please debug and see.
    To achieve your requirement you have to change the navigation to edit page instead of display page..please debug see how navigations are implemented.
    If by default navigation to relationship view is implemented in editable mode then it could be achieved via creating a read only config and switch between editable configuration and read only config. based on the source..
    Hope this helps..
    Cheers,
    Sumit Mittal

  • Update value for XABLN in LIKP  table

    Hi ,
    Is there any way to update the LIKP-XABLN filed yhrough BAPI?
    I tried with this FM    BAPI_OUTB_DELIVERY_CHANGE , but could not succeed.
    Edited by: nancy coner on Jan 27, 2010 9:39 AM

    Hi,
    I need to update LIKP-XABLN field from a Smart Form driver program programaticaly only when the Form is successfully printed.
    I dint find any BAPI / Std Function Module which does the update.
    I dont know how MB_XAB_NUMBER_GET works to update the XABLN field?
    Edited by: nancy coner on Feb 1, 2010 8:03 AM

  • Update in JDBC Sender adapter for more than one table

    Dear Friends,
              I have to select more than one table in the JDBC sender using the join condition. But i found that update statement is also mandatory in the sender comm channel. I am not going to update any flag after the select but as it is mandatory, i have decided to use the following update statement which wont effect the existing data UPDATE <tablename> set flag = ' ' where flag = ' '.
    But in my case i have 3 tables, do i need to update stmts for all the three tables.
    if yes how can i do the same.
    plz revert back i u couldnt get the queries.
    Thanks
    Prem

    HI
    UPDATE T1
    Set T1.flag =1
    where T1.columnA=value1 and T2.columnB=value2
    where T1 and T2 are tables in the same database,
    and the values (value1 and value 2 ) are provided to XI by SAP based on which the flag need to be updated in T1
    write a stored procedure specifying the join and call it in XI.
    For doing it in SQL statement only reffer to the below link ..sur you will get help .
    Multiple records update using JDBC
    Regard's
    Chetan Ahuja

  • How to Display a message after inserting row in table............

    Hi
    I want to display a message after inserting rows in table like *'you have inserted a new row successfully*'.
    i am using the createinsert ADF Button to insert the rows in table.after that i am comitting it.
    after commiting i want to display message for the user.for this what i need to do.
    Please help me.
    Sailaja.

    user10860137
    Can you please explain me the each line in the code briefly.
    +public String saveButton_action(){+
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("Commit");
    Object result = operationBinding.execute();
    +// note "!" operator has been removed from the default code.+
    +if(operationBinding.getErrors().isEmpty()){+
    FacesContext ctx = FacesContext.getCurrentInstance();
    FacesMessage saveMsg = new FacesMessage("Record Saved Successfully");
    ctx.addMessage(null,saveMsg);
    +}+
    return null;
    +}+
    And i have requirement to show the message on favcet "status bar".not in a popup window.(from the above code the message is showing in popup window. )the Layout i am using is PanelCollection.
    can you tell me what i need to do.
    Thanks
    Sailaja.
    Edited by: sj0609 on Mar 19, 2009 8:03 AM

  • Update Trigger for Subinventory in Apps in Prduction Batch deatils

    Dear all
    we have the Apps Application and on the Production Module when creating Batch the form takes Subinventory as default from the setup i need to update it so i created Tigger on the Table after Insert each row update the subinventory field by fixed one
    but nothing updated ?? can any onw help me??
    CREATE OR REPLACE TRIGGER APPS.XXEGYPLAST_UPDATE_SUBINVENTORY
    AFTER INSERT
    ON GME.GME_MATERIAL_DETAILS
    REFERENCING NEW AS New OLD AS Old
    for each row
    DECLARE
    pragma autonomous_transaction;
    t_new_rec GME_MATERIAL_DETAILS%rowtype ;
    NAME: XXEGYPLAST_UPDATE_SUBINVENTORY
    PURPOSE:
    REVISIONS:
    Ver Date Author Description
    1.0 18/09/2012 1. Created this trigger.
    NOTES:
    Automatically available Auto Replace Keywords:
    Object Name: XXEGYPLAST_UPDATE_SUBINVENTORY
    Sysdate: 18/09/2012
    Date and Time: 18/09/2012, 12:21:47 ?, and 18/09/2012 12:21:47 ?
    Username: (set in TOAD Options, Proc Templates)
    Table Name: GME_MATERIAL_DETAILS (set in the "New PL/SQL Object" dialog)
    Trigger Options: (set in the "New PL/SQL Object" dialog)
    PROCEDURE populate_new IS
    BEGIN
    t_new_rec.MATERIAL_DETAIL_ID := :new.MATERIAL_DETAIL_ID ;
    t_new_rec.BATCH_ID := :new.BATCH_ID ;
    t_new_rec.FORMULALINE_ID := :new.FORMULALINE_ID ;
    t_new_rec.LINE_NO := :new.LINE_NO ;
    t_new_rec.ITEM_ID := :new.ITEM_ID ;
    t_new_rec.LINE_TYPE := :new.LINE_TYPE ;
    t_new_rec.PLAN_QTY := :new.PLAN_QTY ;
    t_new_rec.ITEM_UM := :new.ITEM_UM ;
    t_new_rec.ITEM_UM2 := :new.ITEM_UM2 ;
    t_new_rec.ACTUAL_QTY := :new.ACTUAL_QTY ;
    t_new_rec.RELEASE_TYPE := :new.RELEASE_TYPE ;
    t_new_rec.SCRAP_FACTOR := :new.SCRAP_FACTOR ;
    t_new_rec.SCALE_TYPE := :new.SCALE_TYPE ;
    t_new_rec.PHANTOM_TYPE := :new.PHANTOM_TYPE ;
    t_new_rec.COST_ALLOC := :new.COST_ALLOC ;
    t_new_rec.ALLOC_IND := :new.ALLOC_IND ;
    t_new_rec.COST := :new.COST ;
    t_new_rec.TEXT_CODE := :new.TEXT_CODE ;
    t_new_rec.PHANTOM_ID := :new.PHANTOM_ID ;
    t_new_rec.ROUNDING_DIRECTION := :new.ROUNDING_DIRECTION ;
    t_new_rec.CREATION_DATE := :new.CREATION_DATE ;
    t_new_rec.CREATED_BY := :new.CREATED_BY ;
    t_new_rec.LAST_UPDATE_DATE := :new.LAST_UPDATE_DATE ;
    t_new_rec.LAST_UPDATED_BY := :new.LAST_UPDATED_BY ;
    t_new_rec.ATTRIBUTE1 := :new.ATTRIBUTE1 ;
    t_new_rec.ATTRIBUTE2 := :new.ATTRIBUTE2 ;
    t_new_rec.ATTRIBUTE3 := :new.ATTRIBUTE3 ;
    t_new_rec.ATTRIBUTE4 := :new.ATTRIBUTE4 ;
    t_new_rec.ATTRIBUTE5 := :new.ATTRIBUTE5 ;
    t_new_rec.ATTRIBUTE6 := :new.ATTRIBUTE6 ;
    t_new_rec.ATTRIBUTE7 := :new.ATTRIBUTE7 ;
    t_new_rec.ATTRIBUTE8 := :new.ATTRIBUTE8 ;
    t_new_rec.ATTRIBUTE9 := :new.ATTRIBUTE9 ;
    t_new_rec.ATTRIBUTE10 := :new.ATTRIBUTE10 ;
    t_new_rec.ATTRIBUTE11 := :new.ATTRIBUTE11 ;
    t_new_rec.ATTRIBUTE12 := :new.ATTRIBUTE12 ;
    t_new_rec.ATTRIBUTE13 := :new.ATTRIBUTE13 ;
    t_new_rec.ATTRIBUTE14 := :new.ATTRIBUTE14 ;
    t_new_rec.ATTRIBUTE15 := :new.ATTRIBUTE15 ;
    t_new_rec.ATTRIBUTE16 := :new.ATTRIBUTE16 ;
    t_new_rec.ATTRIBUTE17 := :new.ATTRIBUTE17 ;
    t_new_rec.ATTRIBUTE18 := :new.ATTRIBUTE18 ;
    t_new_rec.ATTRIBUTE19 := :new.ATTRIBUTE19 ;
    t_new_rec.ATTRIBUTE20 := :new.ATTRIBUTE20 ;
    t_new_rec.ATTRIBUTE21 := :new.ATTRIBUTE21 ;
    t_new_rec.ATTRIBUTE22 := :new.ATTRIBUTE22 ;
    t_new_rec.ATTRIBUTE23 := :new.ATTRIBUTE23 ;
    t_new_rec.ATTRIBUTE24 := :new.ATTRIBUTE24 ;
    t_new_rec.ATTRIBUTE25 := :new.ATTRIBUTE25 ;
    t_new_rec.ATTRIBUTE26 := :new.ATTRIBUTE26 ;
    t_new_rec.ATTRIBUTE27 := :new.ATTRIBUTE27 ;
    t_new_rec.ATTRIBUTE28 := :new.ATTRIBUTE28 ;
    t_new_rec.ATTRIBUTE29 := :new.ATTRIBUTE29 ;
    t_new_rec.ATTRIBUTE30 := :new.ATTRIBUTE30 ;
    t_new_rec.ATTRIBUTE_CATEGORY := :new.ATTRIBUTE_CATEGORY ;
    t_new_rec.LAST_UPDATE_LOGIN := :new.LAST_UPDATE_LOGIN ;
    t_new_rec.SCALE_ROUNDING_VARIANCE := :new.SCALE_ROUNDING_VARIANCE ;
    t_new_rec.SCALE_MULTIPLE := :new.SCALE_MULTIPLE ;
    t_new_rec.CONTRIBUTE_YIELD_IND := :new.CONTRIBUTE_YIELD_IND ;
    t_new_rec.CONTRIBUTE_STEP_QTY_IND := :new.CONTRIBUTE_STEP_QTY_IND ;
    t_new_rec.WIP_PLAN_QTY := :new.WIP_PLAN_QTY ;
    t_new_rec.ORIGINAL_QTY := :new.ORIGINAL_QTY ;
    t_new_rec.BY_PRODUCT_TYPE := :new.BY_PRODUCT_TYPE ;
    END populate_new ;
    BEGIN
    -- if :New.created_by = '2078' then
    update GME.GME_MATERIAL_DETAILS
    set SUBINVENTORY = 'M . B'
    where LINE_TYPE = :New.LINE_TYPE
    and BATCH_ID = :New.BATCH_ID
    and LINE_NO = :New.LINE_NO;
    COMMIT;
    --end if;
    EXCEPTION
    WHEN OTHERS THEN
    FND_MESSAGE.SET_NAME('GME', 'GME_UNEXPECTED_UPDATE_ERROR');
    FND_MESSAGE.SET_TOKEN('ERROR', sqlerrm);
    fnd_message.raise_error;
    RAISE_APPLICATION_ERROR(-20400,'An error has occured.Please contact your system administrator'||SQLCODE||SQLERRM);
    END XXEGYPLAST_UPDATE_SUBINVENTORY;
    /

    If I try to remove anything unused from your long post this is what I get:
    +(And please another time format your code - makes it very much easier to read...)+
    user11973451 wrote:
    CREATE OR REPLACE TRIGGER APPS.XXEGYPLAST_UPDATE_SUBINVENTORY
    AFTER INSERT
    ON GME.GME_MATERIAL_DETAILS
    REFERENCING NEW AS New OLD AS Old
    for each row
    DECLARE
    pragma autonomous_transaction;
    BEGIN
    update GME.GME_MATERIAL_DETAILS
    set SUBINVENTORY = 'M . B'
    where LINE_TYPE = :New.LINE_TYPE
    and BATCH_ID = :New.BATCH_ID
    and LINE_NO = :New.LINE_NO;
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    FND_MESSAGE.SET_NAME('GME', 'GME_UNEXPECTED_UPDATE_ERROR');
    FND_MESSAGE.SET_TOKEN('ERROR', sqlerrm);
    fnd_message.raise_error;
    RAISE_APPLICATION_ERROR(-20400,'An error has occured.Please contact your system administrator'||SQLCODE||SQLERRM);
    END XXEGYPLAST_UPDATE_SUBINVENTORY;
    /That big local procedure wasn't used in your code, so the above is easier to see what you are doing.
    And I don't understand what you are trying to do here?
    You have an AFTER INSERT trigger that tries with an autonomous transaction to update a column of the same record (and maybe some other records with same LINE_TYPE / BATCH_ID / LINE_NO as well?)
    What is the purpose of this?
    I think what you maybe is experiencing is, that you execute an insert, then in the trigger you try to update the same record, but to avoid mutating table error you have created the trigger in an autonomous transaction, and therefore the trigger cannot yet see the inserted record as that has not yet been committed.
    If the update is supposed to update just one record, then maybe a BEFORE INSERT trigger to just set the value of :new.SUBINVENTORY?
    If supposed to update more than one, then exchange your autonomous transaction with one of the better ways of avoiding mutating table error by remembering the rows to update in "for each row" triggers and then do the updates at the end in an after insert trigger without "for each row."

  • Xml to Oracle (Update more than one row)

    Hi,
    I want to update more than one row in table from .xml file. My xml file is as follows:
    <ROOT>
    <PROFILE PROFILEMASTER_PKEY="54" DB_MSTR_PKEY="2" PROFILE_NAME="Bhushans" DELIMETER="~" PRE_PROCESSOR="1" POST_PROCESSOR="10" PRE_PROCESSOR_TYPE="1" POST_PROCESSOR_TYPE="2" GROUPID="2" />
    <PROFILEDETAILS PROFILEMASTER_PKEY="54" TARGET_SOURCE_TABLE="FM_FEEDVALIDATION_LU" COLUMN_NAME="FEEDVALIDATION_ID" DATA_TYPE="NUMBER" DATA_SIZE="22" START_POSITION="12" END_POSITION="22" COLUMNORDER="1" PROFILEDETAILS_PKEY="399"/>
    <PROFILEDETAILS PROFILEMASTER_PKEY="54" TARGET_SOURCE_TABLE="FM_FEEDVALIDATION_LU" COLUMN_NAME="CHANGE_TYPE" DATA_TYPE="VARCHAR2" DATA_SIZE="1" START_POSITION="12" END_POSITION="144" COLUMNORDER="5" PROFILEDETAILS_PKEY="403"/>
    <OPTIONS PROFILEMASTER_PKEY ="54" LDR_SYNTX_DTLS_PKEY ="19" OPTIONVALUE="@" PROFILE_CFILE_PKEY="337" />
    <OPTIONS PROFILEMASTER_PKEY ="54" LDR_SYNTX_DTLS_PKEY ="19" OPTIONVALUE="~" PROFILE_CFILE_PKEY="336" />
    </ROOT>
    To update according to xml file, I have written following procedure. My procedure updates the table if u r updating 1 row. If you try to update more than 1 row, I mean .xml file contains more than 1 row then my procedure doesn't work. Please help to solve this problem.
    Procedure:
    create or replace procedure fm_prc_xml_dup_up
    as
    f utl_file.file_type;
    s varchar2(2000);
    v varchar2(3000);
    xml XMLType;
    v_pmpk number;
    v_sdtl_pk number;
    chng_typ VARCHAR2(20);
    type r1 is ref cursor;
    rcur r1;
    v1 varchar2(120);
    v2 number;
    begin
    f := utl_file.fopen('CITI', 'S.XML', 'R');
    loop
    utl_file.get_line(f, s);
    v := v || ' ' || s;
    end loop;
    exception
    when no_data_found then
    utl_file.fclose(f);
    xml := xmltype(v);
    SELECT extract(xml, 'ROOT/CHANGE/@CHANGETYPE').getstringval()
    INTO CHNG_TYP
    FROM DUAL;
    UPDATE FM_PROFILEMAST
    set db_mstr_pkey = extract(xml, 'ROOT/PROFILE/@DB_MSTR_PKEY').getnumberval(),
    profile_name = extract(xml, 'ROOT/PROFILE/@PROFILE_NAME').getstringval(),
    file_type = extract(xml, 'ROOT/PROFILE/@FILE_TYPE').getstringval(),
    delimiter = extract(xml, 'ROOT/PROFILE/@DELIMETER').getstringval(),
    pre_processor = extract(xml, 'ROOT/PROFILE/@PRE_PROCESSOR').getstringval(),
    post_processor = extract(xml, 'ROOT/PROFILE/@POST_PROCESSOR').getstringval(),
    pre_processor_type = extract(xml, 'ROOT/PROFILE/@PRE_PROCESSOR_TYPE').getstringval(),
    post_processor_type = extract(xml, 'ROOT/PROFILE/@POST_PROCESSOR_TYPE').getstringval(),
    groupid = extract(xml, 'ROOT/PROFILE/@GROUPID').getstringval(),
    change_type = 'U',
    change_by = chng_typ,
    change_dt = default,
    active_flag = default
    WHERE profilemaster_pkey = extract(xml, 'ROOT/PROFILE/@PROFILEMASTER_PKEY').getnumberval();
    UPDATE FM_PROFILEDET
    SET target_source_table = extract(xml, 'ROOT/PROFILEDETAILS/@TARGET_SOURCE_TABLE').getstringval(),
    column_name = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMN_NAME').getstringval(),
    data_type = extract(xml, 'ROOT/PROFILEDETAILS/@DATA_TYPE').getstringval(),
    data_size = extract(xml, 'ROOT/PROFILEDETAILS/@DATA_SIZE').getnumberval(),
    start_position = extract(xml, 'ROOT/PROFILEDETAILS/@START_POSITION').getnumberval(),
    end_position = extract(xml, 'ROOT/PROFILEDETAILS/@END_POSITION').getnumberval(),
    change_by = chng_typ,
    change_dt = default,
    columnorder = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMNORDER').getstringval(),
    column_format = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMN_FORMAT').getstringval(),
    nullable = extract(xml, 'ROOT/PROFILEDETAILS/@NULLABLE').getstringval(),
    change_type ='U',
    active_flag = default
    WHERE profiledetails_pkey = extract(xml, 'ROOT/PROFILEDETAILS/@PROFILEDETAILS_PKEY').getstringval();
    UPDATE FM_PROFILE_CFILE
    SET profilemaster_pkey = extract(xml, 'ROOT/PROFILE/@PROFILEMASTER_PKEY').getnumberval(),
    ldr_syntx_dtls_pkey = extract(xml, 'ROOT/OPTIONS/@LDR_SYNTX_DTLS_PKEY').getstringval(),
    val = extract(xml, 'ROOT/OPTIONS/@OPTIONVALUE').getstringval(),
    change_by = chng_typ,
    change_dt = default,
    sub_line_seq = extract(xml, 'ROOT/OPTIONS/@SUB_LINE_SEQ').getstringval(),
    change_type = 'U',
    active_flag = default
    where profile_cfile_pkey = extract(xml, 'ROOT/OPTIONS/@PROFILE_CFILE_PKEY').getnumberval();
    END;

    Hi Bhushan,
    one where clause is missing in the main update.
    update fm_profiledet
    set (....)
    =(select ....)
    where id in (select your profiledetails_pkey from the xml). <--this where clause were missing.
    if xml extracting is too slow(xml very large) then you can create a procedure where exract your data from the xml and then update rows in for loop.
    something like this
    create procedure up_xmls(p_xml xmltype) is
    cursor cur_xml(p_xml xmltype) is
    select ......<--here you extract your xml
    begin
    for r_row in cur_xml(p_xml) loop
    update fm_profiledet set target_source_table=r_row.target_source_table
    where profiledetails_pkey=r_row.profiledetails_pkey;
    end loop;
    end;this should work:
    SQL> drop table fm_profiledet;
    Table dropped.
    SQL> create table fm_profiledet(
      2   profiledetails_pkey number
      3  ,target_source_table varchar2(100)
      4  ,column_name varchar2(100)
      5  ,data_type varchar2(100)
      6  ,data_size number
      7  ,start_position number
      8  ,change_type varchar2(100)
      9  )
    10  /
    Table created.
    SQL>
    SQL>
    SQL> insert into fm_profiledet
      2  values(399,'test','test1','test2',1,2,'A')
      3  /
    1 row created.
    SQL>
    SQL>
    SQL> insert into fm_profiledet
      2  values(403,'test3','test4','test5',3,4,'B')
      3  /
    1 row created.
    SQL> insert into fm_profiledet
      2  values(443,'test3','test4','test5',3,7,'B')
      3  /
    1 row created.
    SQL>
    SQL>
    SQL> select * from fm_profiledet;
    PROFILEDETAILS_PKEY TARGET_SOU COLUMN_NAM DATA_TYPE  DATA_SIZE START_POSITION CHANGE_TYP                               
                    399 test       test1      test2              1              2 A                                        
                    403 test3      test4      test5              3              4 B                                        
                    443 test3      test4      test5              3              7 B                                        
    SQL>
    SQL> create or replace directory xmldir as '/home/ants';
    Directory created.
    SQL>
    SQL>
    SQL>
    SQL> update fm_profiledet fm
      2  set (target_source_table,column_name, data_type, data_size, start_position,change_type)
      3  =(
      4    select  target_source_table
      5          , column_name
      6          , data_type
      7          , data_size
      8          , start_position
      9          , change_type
    10    from(
    11      select
    12        extractValue(value(x),'/PROFILEDETAILS/@PROFILEDETAILS_PKEY') profiledetails_pkey
    13      , extractValue(value(x),'/PROFILEDETAILS/@TARGET_SOURCE_TABLE') target_source_table
    14      , extractValue(value(x),'/PROFILEDETAILS/@COLUMN_NAME') column_name
    15      , extractValue(value(x),'/PROFILEDETAILS/@DATA_TYPE') data_type
    16      , extractValue(value(x),'/PROFILEDETAILS/@DATA_SIZE') data_size
    17      , extractValue(value(x),'/PROFILEDETAILS/@START_POSITION') start_position
    18      ,'U' change_type
    19     from
    20      table(xmlsequence(extract(xmltype(bfilename('XMLDIR','prof.xml')
    21                                      ,nls_charset_id('AL32UTF8'))
    22                               , '/ROOT/PROFILEDETAILS'))) x
    23    ) s
    24  where s.profiledetails_pkey=fm.profiledetails_pkey)
    25  where
    26    fm.profiledetails_pkey in (select
    27        extractValue(value(x),'/PROFILEDETAILS/@PROFILEDETAILS_PKEY') profiledetails_pkey
    28     from
    29      table(xmlsequence(extract(xmltype(bfilename('XMLDIR','prof.xml')
    30                                      ,nls_charset_id('AL32UTF8'))
    31                               , '/ROOT/PROFILEDETAILS'))) x
    32  );
    2 rows updated.
    SQL>
    SQL>
    SQL> select * from fm_profiledet;
    PROFILEDETAILS_PKEY TARGET_SOU COLUMN_NAM DATA_TYPE  DATA_SIZE START_POSITION CHANGE_TYP                               
                    399 FM_FEEDVAL FEEDVALIDA NUMBER            22             12 U                                        
                        IDATION_LU TION_ID                                                                                 
                    403 FM_FEEDVAL CHANGE_TYP VARCHAR2           1             12 U                                        
                        IDATION_LU E                                                                                       
                    443 test3      test4      test5              3              7 B                                        
    SQL> spool off;Ants
    Message was edited by:
    Ants Hindpere

  • Using a LOV in an Update page for a QBE Report

    In my QBE Report-based portlet, I have set one of the fields to use a LOV.
    When I go into Customize for the portlet, that field uses the LOV, but when I click on the Update link for a row, the same field does NOT use the LOV.
    How do I make it use the LOV in the Update page?
    Thanks for any help!
    Regards
    Bryan

    Folks --
    Is this question a difficult one?
    I'd appreciate even a pointer...
    Thanks
    Bryan

  • Better approach for deleting rows using trigger or procedure

    Hi,
    Please suggest which option is better for deleting rows from table trigger or procedure and why?
    In datawarehousing and OLTP DB's.
    Edited by: user6040008 on Nov 2, 2012 4:51 AM

    Hi,
    Please suggest which option is better for deleting rows from table trigger or procedure and why?
    In datawarehousing and OLTP DB's.
    Edited by: user6040008 on Nov 2, 2012 4:51 AM

Maybe you are looking for

  • How to open a file(available on Desktop) from SAP?

    Hi, I have created dialog program. when i execute this program, it show one browse button. when user press this browse button, it display a dialog box and user can select file available on their desktop. e.g: Selected file path is  "c:\gaurav.txt" I

  • Full Screen Playback + Add Marker Q

    Is there a way to add a marker while watching in full screen? Previously I was able to do this by tapping M as I watched, then I could go back and add any notes to each marker location in the Browser clip or Sequence. Doesn't seem to work with 10.0.5

  • Invalid UTF8 encoding & XSU

    I am using XSU version 1.2. to generating an XML document from data which contains German (d,|,v). The XML parser (2) cannot handle this. The error i get is: ERROR at line 1: ORA-20100: Error occurred while parsing: Invalid UTF8 encoding. ORA-06512:

  • Mail, and why

    So one day "mail" just stopped seeing my password. After trying several times with the support site and doing it on my own it still doesn't see my password. Oh it works online and on everything else I own but not on the main machine. This is the same

  • Calculate depreciation and generate Assets History Sheet / system currency?

    Hi, I want to know if I can calculate the depreciation and generate Assets History Sheet in system currency which is different of local currency. in fact the amount of depreciation calculated in TND and converted in euro is different of the amount ca