Updating previous row in a duplicate without subquery

I need to update all records and set status= "delete" where the records are duplicates and the plan_eff_date = previous plan_eff_date date.
*1st Example*
In the case of Martin K Holdrich i need to update the status of the first two rows to delete and keep the third row and not update.
*2nd Example*
In the case of Julio A Espichan and Melissa Alexand Espichan none of the rows are update because none of the plan_eff_date are equal.
first_name middle_init last_name plan_eff_date plan_term_date status
Martin K Holdrich 1/1/2008 2/1/2008 delete
Martin K Holdrich 1/1/2008 12/1/2008 Delete
Martin K Holdrich 1/1/2008 12/31/2099
Sallie L Holdrich 1/1/2008 2/1/2008 Delete
Sallie L Holdrich 1/1/2008 12/1/2008 Delete
Sallie L Holdrich 1/1/2008 12/31/2099
August Pearson Holdrich 1/1/2008 2/1/2008 Delete
August Pearson Holdrich 1/1/2008 12/1/2008 Delete
August Pearson Holdrich 1/1/2008 12/31/2099
William Holdrich 1/1/2008 2/1/2008 Delete
William Holdrich 1/1/2008 12/1/2008 Delete
William Holdrich 1/1/2008 12/31/2099
Charlotte Holdrich 1/1/2008 2/1/2008 Delete
Charlotte Holdrich 1/1/2008 12/1/2008 Delete
Charlotte Holdrich 1/1/2008 12/31/2099
Emma R Holdrich 1/1/2008 2/1/2008 Delete
Emma R Holdrich 1/1/2008 12/1/2008 Delete
Emma R Holdrich 1/1/2008 12/31/2099
Julio A Espichan 5/1/2008 1/1/2009
Julio A Espichan 1/1/2009 12/31/2099
Karen Yojany Espichan 5/1/2008 1/1/2009
Karen Yojany Espichan 1/1/2009 12/31/2099
Melissa Alexand Espichan 5/1/2008 1/1/2009
Melissa Alexand Espichan 1/1/2009 12/31/2099
Edited by: user581807 on Mar 9, 2009 7:43 AM
Edited by: user581807 on Mar 9, 2009 7:44 AM
Edited by: user581807 on Mar 9, 2009 7:46 AM
Edited by: user581807 on Mar 18, 2009 5:34 AM
Edited by: user581807 on Mar 18, 2009 5:35 AM
Edited by: user581807 on Mar 18, 2009 5:54 AM

Changed the update a bit
update users a set status ='delete'
where exists
    (select b.first_name, b.middle_init, b.last_name, b.plan_eff_date,
        count(*)
        from users b,
             (select first_name, middle_init, last_name, plan_eff_date,
                     max(plan_term_date) plan_term_date
                from users
                group by first_name, middle_init, last_name, plan_eff_date) x
        where a.last_name = b.last_name
          and a.middle_init = b.middle_init
          and a.first_name = b.first_name
          and a.plan_eff_date = b.plan_eff_date
          and a.plan_term_date <> x.plan_term_date
          and b.plan_term_date <> x.plan_term_date
          and b.last_name = x.last_name
          and b.middle_init = x.middle_init
          and b.first_name = x.first_name
          and b.plan_eff_date = x.plan_eff_date
          and b.plan_term_date = b.plan_term_date
      group by b.first_name, b.middle_init, b.last_name, b.plan_eff_date
      having count(*) > 1)

Similar Messages

  • Update field taking value from previous row

    I have a table TEST (ID int, name varchar(20), amount decimal(18,0)).
    First row of the table have correct value. I want to update amount column except first row by adding 10 with the previous row value without using cursor.
    id    Name    Amount
    1    abc    10
    2    def    15
    3    ghi    20
    4    jkl    22
    5    mno    25
    6    pqr    27
    7    stu    30
    8    vwx    33
    id    Name    Amount
    1    abc    10
    2    def    20
    3    ghi    30
    4    jkl    40
    5    mno    50
    6    pqr    60
    7    stu    70
    8    vwx    80
    please help me.
    thanks
    srimanta manna

    create table #t (id int, amount int)
    insert into #t values (1,10)
    insert into #t values (2,25)
    insert into #t values (3,46)
    insert into #t values (4,55)
    insert into #t values (5,160)
    insert into #t values (6,89)
    insert into #t values (7,100)
    with cte
    as
    select *,(select min(amount) from #t t where t.id=1) as a
    FROM #t 
    ) update #t set amount=(select sum(a) from cte c where c.id<=cte.id) 
     from cte where #t.id=cte.id
     select * from #t
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Update Failed for Sum of previous row and current row

    Hi i need to update the column length of the previous row and current row so i followed this method but i'm unable to update what is problem in my syntax
    SQL> begin
    2 DECLARE Total number = 0;
    3 UPDATE StringOutput set Total = SumOfLength = Total + ColLength;
    4 end;
    5 /
    DECLARE Total number = 0;
    ERROR at line 2:
    ORA-06550: line 2, column 22:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    := . ( @ % ; not null range default character
    if i update without the variable total then my command is succeeded
    UPDATE StringOutput set SumOfLength = ColLength;
    but i need the previous row+current row count in SumOfLength
    Thanks!

    Getting this error now
    SQL> begin
    2 DECLARE Total number := 0;
    3 UPDATE StringOutput set Total = SumOfLength = Total + ColLength;
    4 end;
    5 /
    UPDATE StringOutput set Total = SumOfLength = Total + ColLength;
    ERROR at line 3:
    ORA-06550: line 3, column 1:
    PLS-00103: Encountered the symbol "UPDATE" when expecting one of the following:
    begin function pragma procedure subtype type <an identifier>
    <a double-quoted delimited-identifier> current cursor delete
    exists prior
    The symbol "begin" was substituted for "UPDATE" to continue.
    ORA-06550: line 3, column 46:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    . ( , * @ % & - + ; / at mod remainder rem return returning
    <an exponent (**)> where || multiset
    The symbol ". was inserted before "=" to continue.
    ORA-06550: line 4, column 4:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
    following:
    ( begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted

  • Trouble updating multiple rows in table using subquery

    Hi everyone, I'm having trouble updating multiple rows with a subquery. Here's the setup:
    create table mytable (
    col_a number primary key,
    col_b number,
    col_c number,
    col_d number);
    insert into mytable values (1 ,1,1,15);
    insert into mytable values (2 ,1,2,7 );
    insert into mytable values (3 ,1,3,11);
    insert into mytable values (4 ,1,4,23);
    insert into mytable values (5 ,1,5,14);
    insert into mytable values (6 ,2,1,50);
    insert into mytable values (7 ,2,2,41);
    insert into mytable values (8 ,2,3,13);
    insert into mytable values (9 ,2,4,12);
    insert into mytable values (10,2,5,19);
    insert into mytable values (11,3,1,10);
    insert into mytable values (12,3,2,92);
    insert into mytable values (13,3,3,81);
    insert into mytable values (14,3,4,17);
    insert into mytable values (15,3,5,66);
    insert into mytable values (16,4,1,54);
    insert into mytable values (17,4,2,41);
    insert into mytable values (18,4,3,22);
    insert into mytable values (19,4,4,24);
    insert into mytable values (20,4,5,17);For this example, using an update statement (or merge if that's better), say I want to set the values for col_d where col_b = 3 equal to the values for col_d where col_b = 1 and col_c equal each other. Results should look like the following after the update:
    col_a col_b col_c col_d
    1     1     1     15
    2     1     2     7
    3     1     3     11
    4     1     4     23
    5     1     5     14
    6     2     1     50
    7     2     2     41
    8     2     3     13
    9     2     4     12
    10    2     5     19
    11    3     1     15
    12    3     2     7
    13    3     3     11
    14    3     4     23
    15    3     5     14
    16    4     1     54
    17    4     2     41
    18    4     3     22
    19    4     4     24
    20    4     5     17I can see it right there at my fingertips using this query, where I want to set b_col_d = a_col_d, but I'm missing something, as this query returns too many rows when used in the update statement.
    select * from (
      select col_a as a_col_a, col_b as a_col_b, col_c as a_col_c, col_d as a_col_d
      from mytable
      where col_b = 1
      ) a, (
      select col_a as b_col_a, col_b as b_col_b, col_c as b_col_c, col_d as b_col_d
      from mytable
      where col_b = 3
      ) b
    where a.a_col_c = b.b_col_cupdate mytable set column_d = (select ??? where exists ???)
    Can someone help me get there? I'm using 10GR2.
    Thanks!
    Mark

    Hopefully this is what you are looking for:
    SQL > UPDATE mytable myt1
      2  SET    col_d = ( SELECT myt2.col_d
      3                   FROM   mytable myt2
      4                   WHERE  myt2.col_b = 1
      5                   AND    myt1.col_c = myt2.col_c
      6                 )
      7  WHERE  col_b = 3
      8  AND    EXISTS
      9         ( SELECT NULL
    10           FROM   mytable myt2
    11           WHERE  myt2.col_c = myt1.col_c
    12         )
    13  ;
    5 rows updated.
    SQL > SELECT * FROM mytable ORDER BY col_a;
                   COL_A                COL_B                COL_C                COL_D
                       1                    1                    1                   15
                       2                    1                    2                    7
                       3                    1                    3                   11
                       4                    1                    4                   23
                       5                    1                    5                   14
                       6                    2                    1                   50
                       7                    2                    2                   41
                       8                    2                    3                   13
                       9                    2                    4                   12
                      10                    2                    5                   19
                      11                    3                    1                   15
                      12                    3                    2                    7
                      13                    3                    3                   11
                      14                    3                    4                   23
                      15                    3                    5                   14
                      16                    4                    1                   54
                      17                    4                    2                   41
                      18                    4                    3                   22
                      19                    4                    4                   24
                      20                    4                    5                   17
    20 rows selected.Thank you so much for providing the sample data in an easy to consume form, as well as the expected output.

  • Adding a Multiple Rows Without Clearing Previous Row Details

    Dear All,
    I want to Add multiple rows at the same time in a matrix at the same time .My problem here is When i add the New rows to the matrix already added data need to remail in the matrix , I cant put Matrix.Clear or Datasource.clear.
    When   i add multiple rows previous row details is duplicated to next rows how to avoid thus
    Mohamed

    Hi,
    try this,
    If (pVal.ItemUID = "BTNUID") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
                            Dim fr As SAPbouiCOM.Form
                            Dim sel As Integer
                            Dim oMatrix1 As SAPbouiCOM.Matrix
                            fr = SBO_Application.Forms.Item(FormUID)
                            oMatrix1 = fr.Items.Item("mtx_136").Specific
                            fr.DataSources.DBDataSources.Item(2).Clear()
                            sel = oMatrix1.GetNextSelectedRow
                            oMatrix1.AddRow(1, sel)
                        End If
    "mtx_136" is your matrix ID
    and "BTNUID" is your button ID

  • Updating Apps on second hand Ipad without previous owners password

    I purchased an Ipad from a friend who bought it new. I find I cannot update some Apps he had installed without his password. How can I do this without losing the Apps.

    Apps are tied to the Apple ID used to purchase them. Your friend should have wiped it before giving it to you: What to do before selling or giving away your iPhone, iPad, or iPod touch

  • Eliminating duplicates from subquery...

    What is the best way to eliminate duplicates from a subquery:
    SELECT dept_no, dept_name
    FROM dept D
    WHERE EXISTS (
    SELECT 'X'
    FROM emp E
    WHERE E.dept_no = D.dept_no);
    OR
    SELECT dept_no, dept_name
    FROM dept D
    WHERE ( SELECT 'X'
    FROM emp E
    WHERE E.dept_no = D.dept_no AND ROWNUM < 2);
    Thanks!

    >
    UPDATE TABLE1
    SET COL1 = (
    SELECT DISTINCT COL1
    FROM TABLE2, TABLE3
    WHERE TABLE2.ID = TABLE3.ID
    You need to refine your example. At present you appear to be updating every row in table1 to the same value - but only if col1 (which could be from table2 or table3 - or might be accidental capture from table1) holds just one distinct value across the query; but it looks as if you're likely to get 'single row subquery returns more than one row[ as an error.
    I guess you're trying to do something LIKE:
    update t1
    set t1.col1 = (
      select t2.col2
      from t2
      where  t2.colx = t1.coly
      and  exists (
        select null
        from t3
        where t3.id = t2.id
    )The most efficient access path depends on how many rows will have to be examined in each table, and how many times you will have to jump to another table to find related data - and if your query is roughly the shape of this one, the optimizer may be able to transform it in a variety of ways to find an efficient access path.
    As it stands, my example will be setting col1 to null whenever there is no match for coly in table t2 - and the optimizer would have to drive off t1 looking at every row to do this. Your requirement, and available predicates, indexes and constraints, may allow, or force, a completely different strategy.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

  • Sum of Values from previous rows in a dynamic table

    Hello,
    I have a dynamic table has multiple rows (added dynamically via a button).  One column in the table is a Quantity column.  Another is a Total column.  We do not want to keep a running total, but only wish to display a total when the rest of the cells in that row are emty and the previous row(s) has/have values in the Quantity column.  The Total is the sum on the Quatnities up to a blank row.  Below is a sample.  How do I get teh value of the Quantities in the previous rows?
    Quantity
    Total
    5
    8
    12
    25
    7
    27
    34
    22
    22
    Another option might be to put the Total in the last row with data as opposed to the row below the data.
    Any ideas?
    Regards,
    Karl

    The script is written to achive your requirement (i.e. the second approach you have mentioned)
    You can either contact me at [email protected] to get the sample form created.
    Or the following is the XML Source of the form. Copy the entire content in XML source view of your form and see the result.
    <?xml version="1.0" encoding="UTF-8"?>
    <?xfa generator="AdobeLiveCycleDesignerES_V9.0.0.0.20091029.1.612548" APIVersion="3.1.9277.0"?>
    <xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2012-02-28T14:04:54Z" uuid="2c561cdf-3377-4e84-9a89-51e740bb2fea">
    <template xmlns="http://www.xfa.org/schema/xfa-template/2.8/">
    <?formServer defaultPDFRenderFormat acrobat9.0dynamic?>
    <subform name="form1" layout="tb" locale="en_US" restoreState="auto">
    <pageSet>
    <pageArea name="Page1" id="Page1">
    <contentArea x="0.25in" y="0.25in" w="197.3mm" h="284.3mm"/>
    <medium stock="a4" short="210mm" long="297mm"/>
    <?templateDesigner expand 1?></pageArea>
    <?templateDesigner expand 1?></pageSet>
    <subform w="197.3mm" layout="tb">
    <subform name="Subform1" w="190.5mm" h="25.4mm">
    <field name="Button1" y="15.875mm" x="60.325mm" w="28.575mm" h="6mm">
    <ui>
    <button highlight="inverted"/>
    </ui>
    <font typeface="Myriad Pro"/>
    <caption>
    <value>
    <text>Add Row</text>
    </value>
    <para vAlign="middle" hAlign="center"/>
    </caption>
    <border hand="right">
    <?templateDesigner StyleID apbx2?>
    <edge stroke="raised"/>
    <fill/>
    </border>
    <bind match="none"/>
    <event activity="click" name="event__click">
    <script contentType="application/x-javascript">
    try
    Subform2.Table1._Row1.addInstance(1);
    //for(var i=0;i&lt;Subform2.Table1._Row1.count;i++)
    //xfa.resolveNode("Subform2.Table1.Row1["+i+"].Total").execEvent("exit");
    }catch(e)
    app.alert(e)
    </script>
    </event>
    </field>
    <?templateDesigner expand 1?></subform>
    <subform name="Subform2" w="196.85mm">
    <subform name="Table1" layout="table" columnWidths="55.916mm 44.47mm" x="38.1mm" y="12.7mm">
    <border>
    <edge/>
    </border>
    <subform layout="row" name="HeaderRow" id="HeaderRow_ID">
    <assist role="TH"/>
    <draw h="10mm" name="Cell1">
    <border>
    <edge/>
    <corner thickness="0.1778mm"/>
    </border>
    <ui>
    <textEdit/>
    </ui>
    <value>
    <text>Quantity</text>
    </value>
    <font typeface="Myriad Pro"/>
    <margin topInset="0.5mm" bottomInset="0.5mm" leftInset="0.5mm" rightInset="0.5mm"/>
    <para vAlign="middle" hAlign="center"/>
    </draw>
    <draw h="10mm" name="Cell2">
    <border>
    <edge/>
    <corner thickness="0.1778mm"/>
    </border>
    <ui>
    <textEdit/>
    </ui>
    <value>
    <text>Total</text>
    </value>
    <font typeface="Myriad Pro"/>
    <margin topInset="0.5mm" bottomInset="0.5mm" leftInset="0.5mm" rightInset="0.5mm"/>
    <para vAlign="middle" hAlign="center"/>
    </draw>
    <border>
    <edge presence="hidden"/>
    </border>
    <occur max="-1"/>
    <?templateDesigner expand 1?></subform>
    <subform layout="row" name="Row1">
    <assist role="TR"/>
    <field name="Quantity" w="55.916mm" h="9.317mm">
    <ui>
    <numericEdit>
    <border presence="hidden">
    <?templateDesigner StyleID aped0?></border>
    <margin/>
    </numericEdit>
    </ui
    ><
    font typeface="Myriad Pro"/><
    margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/><
    para vAlign="middle"/><
    border><
    edge/><
    corner thickness="0.1778mm"/></
    border></
    field><
    field name="Total" w="44.47mm" h="9.317mm" access="readOnly"><
    ui><
    numericEdit><
    border presence="hidden"> 
    <?templateDesigner StyleID aped0?>
    </border><
    margin/></
    numericEdit></
    ui><
    font typeface="Myriad Pro"/><
    margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/><para vAlign="middle"/>
    <border>
    <edge/>
    <corner thickness="0.1778mm"/>
    </border>
    <calculate>
    <script contentType="application/x-javascript">
    try
    var nextRow = xfa.resolveNode("Subform2.Table1.Row1["+(this.parent.instanceIndex+1)+"]"); // Next row of the table
    if((nextRow==null || nextRow.Quantity.rawValue == null || nextRow.Quantity.rawValue=="") &amp;&amp; Quantity.rawValue!=null) // If there is no more rows OR the next row don't contain any Quantity value
    var subTotal = 0;
    for(var j=this.parent.instanceIndex;j&gt;=0;j--) // Loop until the previous row has empty value OR reach start of row Index (i.e. 0)
    var prevObj = xfa.resolveNode("Subform2.Table1.Row1["+j+"].Quantity"); // locate the previous row's Quantity object
    if(prevObj.rawValue == null || prevObj.rawValue=="")
    break; // if blank value found, skip the loop
    subTotal+= prevObj.rawValue;
    this.rawValue = subTotal; // Update the Total value
    }else
    this.rawValue = null; // Clear the total value
    }catch(e)
    app.alert(e)
    </script>
    </calculate>
    </field>
    <border>
    <edge presence="hidden"/>
    </border>
    <occur max="-1"/>
    <?templateDesigner expand 1?></subform>
    <keep intact="contentArea"/>
    <?templateDesigner rowpattern first:1, next:1, firstcolor:f0f0f0, nextcolor:ffffff, apply:0?>
    <overflow leader="HeaderRow"/>
    <?templateDesigner expand 1?></subform>
    <?templateDesigner expand 1?></subform>
    <?templateDesigner expand 1?></subform>
    <proto/>
    <desc>
    <text name="version">9.0.0.0.20091029.1.612548.606130</text>
    </desc>
    <?templateDesigner expand 1?></subform>
    <?templateDesigner DefaultPreviewDynamic 1?>
    <?templateDesigner DefaultRunAt client?>
    <?templateDesigner Grid show:1, snap:1, units:0, color:ff8080, origin:(0,0), interval:(125000,125000)?>
    <?templateDesigner FormTargetVersion 28?>
    <?templateDesigner DefaultLanguage JavaScript?>
    <?acrobat JavaScript strictScoping?>
    <?templateDesigner Zoom 62?>
    <?templateDesigner Rulers horizontal:1, vertical:1, guidelines:1, crosshairs:0?>
    <?templateDesigner SaveTaggedPDF 1?>
    <?templateDesigner SavePDFWithEmbeddedFonts 1?></template>
    <config xmlns="http://www.xfa.org/schema/xci/2.8/">
    <agent name="designer">
    <!-- [0..n] -->
    <destination>pdf</destination>
    <pdf>
    <!-- [0..n] -->
    <fontInfo/>
    </pdf>
    </agent>
    <present>
    <!-- [0..n] -->
    <pdf>
    <!-- [0..n] -->
    <fontInfo/>
    <version>1.7</version>
    <adobeExtensionLevel>3</adobeExtensionLevel>
    </pdf>
    <xdp>
    <packets>*</packets>
    </xdp>
    </present>
    </config>
    <localeSet xmlns="http://www.xfa.org/schema/xfa-locale-set/2.7/">
    <locale name="en_US" desc="English (United States)">
    <calendarSymbols name="gregorian">
    <monthNames>
    <month>January</month>
    <month>February</month>
    <month>March</month>
    <month>April</month>
    <month>May</month>
    <month>June</month>
    <month>July</month>
    <month>August</month>
    <month>September</month>
    <month>October</month>
    <month>November</month>
    <month>December</month>
    </monthNames>
    <monthNames abbr="1">
    <month>Jan</month>
    <month>Feb</month>
    <month>Mar</month>
    <month>Apr</month>
    <month>May</month>
    <month>Jun</month>
    <month>Jul</month>
    <month>Aug</month>
    <month>Sep</month>
    <month>Oct</month>
    <month>Nov</month>
    <month>Dec</month>
    </monthNames>
    <dayNames>
    <day>Sunday</day>
    <day>Monday</day>
    <day>Tuesday</day>
    <day>Wednesday</day>
    <day>Thursday</day>
    <day>Friday</day>
    <day>Saturday</day>
    </dayNames>
    <dayNames abbr="1">
    <day>Sun</day>
    <day>Mon</day>
    <day>Tue</day>
    <day>Wed</day>
    <day>Thu</day>
    <day>Fri</day>
    <day>Sat</day>
    </dayNames>
    <meridiemNames>
    <meridiem>AM</meridiem>
    <meridiem>PM</meridiem>
    </meridiemNames>
    <eraNames>
    <era>BC</era>
    <era>AD</era>
    </eraNames>
    </calendarSymbols>
    <datePatterns>
    <datePattern name="full">EEEE, MMMM D, YYYY</datePattern>
    <datePattern name="long">MMMM D, YYYY</datePattern>
    <datePattern name="med">MMM D, YYYY</datePattern>
    <datePattern name="short">M/D/YY</datePattern>
    </datePatterns>
    <timePatterns>
    <timePattern name="full">h:MM:SS A Z</timePattern>
    <timePattern name="long">h:MM:SS A Z</timePattern>
    <timePattern name="med">h:MM:SS A</timePattern>
    <timePattern name="short">h:MM A</timePattern>
    </timePatterns>
    <dateTimeSymbols>GyMdkHmsSEDFwWahKzZ</dateTimeSymbols>
    <numberPatterns>
    <numberPattern name="numeric">z,zz9.zzz</numberPattern>
    <numberPattern name="currency">$z,zz9.99|($z,zz9.99)</numberPattern>
    <numberPattern name="percent">z,zz9%</numberPattern>
    </numberPatterns>
    <numberSymbols>
    <numberSymbol name="decimal">.</numberSymbol>
    <numberSymbol name="grouping">,</numberSymbol>
    <numberSymbol name="percent">%</numberSymbol>
    <numberSymbol name="minus">-</numberSymbol>
    <numberSymbol name="zero">0</numberSymbol>
    </numberSymbols>
    <currencySymbols>
    <currencySymbol name="symbol">$</currencySymbol>
    <currencySymbol name="isoname">USD</currencySymbol>
    <currencySymbol name="decimal">.</currencySymbol>
    </currencySymbols>
    <typefaces>
    <typeface name="Myriad Pro"/>
    <typeface name="Minion Pro"/>
    <typeface name="Courier Std"/>
    <typeface name="Adobe Pi Std"/>
    <typeface name="Adobe Hebrew"/>
    <typeface name="Adobe Arabic"/>
    <typeface name="Adobe Thai"/>
    <typeface name="Kozuka Gothic Pro-VI M"/>
    <typeface name="Kozuka Mincho Pro-VI R"/>
    <typeface name="Adobe Ming Std L"/>
    <typeface name="Adobe Song Std L"/>
    <typeface name="Adobe Myungjo Std M"/>
    </typefaces>
    </locale>
    </localeSet>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.398682, 2009/08/10-13:00:47 ">
    <
    rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><
    rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about=""><
    xmp:MetadataDate>2012-02-28T14:04:54Z</xmp:MetadataDate><
    xmp:CreatorTool>Adobe LiveCycle Designer ES 9.0</xmp:CreatorTool></
    rdf:Description><
    rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about=""><
    pdf:Producer>Adobe LiveCycle Designer ES 9.0</pdf:Producer></
    rdf:Description><
    rdf:Description xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" rdf:about=""><
    xmpMM:DocumentID>uuid:2c561cdf-3377-4e84-9a89-51e740bb2fea</xmpMM:DocumentID></
    rdf:Description><
    rdf:Description xmlns:desc="http://ns.adobe.com/xfa/promoted-desc/" rdf:about=""><
    desc:version rdf:parseType="Resource"><
    rdf:value>9.0.0.0.20091029.1.612548.606130</rdf:value><
    desc:ref>/template/subform[1]</desc:ref></
    desc:version></
    rdf:Description></
    rdf:RDF></
    x:xmpmeta></xdp:xdp>

  • Update all rows in a View Column via one Apex Form field

    Appreciate any helpful answers to this query.
    I have an Apex App (4.x) where I have a view: PRICE_MODEL_CRA_V
    In the view, I have the following applicable columns:
    COUNTRY
    GRADE
    SALARY
    In the form I have the following fields
    :P16_COUNTRY (DROPDOWN)
    :P16_GRADE (DROPDOWN)
    :P16_SALARY (Number)
    In my app, I have a form with an Update button. I am simply trying to get Apex to update all rows in the salaray column in the view, where the country and grade match.
    I've the following code for the Update button:
    UPDATE PRICE_MODEL_CRA_V
    SET SALARY = :P16_SALARY
    WHERE COUNTRY = :P16_COUNTRY
    AND GRADE = :P16_GRADE
    The option I have chosen in condition type is:
    Value of Item / Column expression is NOT Null (as there are values in the column)
    Also tried SQL Expression and it does not like..says that there is No Expression.
    Thanks again if anyone can help :)

    Hi,
    Sorry I realize now that piece of information was not well supported.
    If I choose SQL Expression for Condition Type in my Form Page and I try to Apply Changes
    Apex says this..
    •Failed to parse SQL query!
    ORA-00936: missing expression
    I was assuming that I need to have the colon for the items in the form where I am wanting Apex to grab the values entered by the user. I tried them without the colons with the SQL Expression condition and same result.
    UPDATE PRICE_MODEL_CRA_V
    SET SALARY = P16_SALARY
    WHERE COUNTRY = P16_COUNTRY
    AND GRADE = P16_GRADE
    I did put 1-1/0 in my expression field and applied changes and then tried ot submit the form and it does not produce an error, so perhaps it is not being called? Where would I start with troubleshooting that?
    Thanks,

  • How to Update Particular row in a table from OAF page

    Hi Can anyone please help me on the following requirement:
    In my oaf page i am displaying table values(supplier site details from base tables) with update and delete icons . When i click on update button a new page opens in which we used to update the values and click on apply button which again comes back to the original page.
    So when i click on apply button on update page i have to first search for the site in the site table whether it exists or not, if not exists i have to create a new row and save the data, if site exists in the table i have to update the row of a table for that particular site. I have written code for this but unable to achive the requirement, it is not updating the existing row of the table. And i am doing all this on the Temp tables.
    So now when i save, previous transaction is also updating along with the current transaction. That means when i m trying to save 2nd transaction values , 1st transactions values are getting updated with the 2nd transaction values(2 rows are getting updated)
    Can anyone help me with the code used for updating the current row of the table. Please correct me if i m doing anyting wrong in code.
    following is the current code i m using and which is failing :
    Controller Code
    if(pcontactaction.equals("createECdetailsEvent")) {
    String currentSiteName=pageContext.getParameter("SiteName");
    System.out.println("Selected Site Name is : " + currentSiteName);
    Serializable x[]={reqNum,suppId,currentSiteName,pnotifMethod,pfaxNum};
    System.out.println("Invoking AM Method.........");
    am.invokeMethod("initCreateECDetails",x);
    System.out.println("initCreateECDetails Method Executed. ");
    //am.invokeMethod("save");
    localOAApplicationModule.getTransaction().commit();
    pageContext.setForwardURL(
    "OA.jsp?page=/oracle/apps/floaf/flpos/supregister/webui/ECDetailsPG"
    , null //not needed as we are retaining menu context
    ,OAWebBeanConstants.KEEP_MENU_CONTEXT
    , null //not needed as we are retaining menu context
    ,null // no parameters are needed
    ,true //retain AM
    ,OAWebBeanConstants.ADD_BREAD_CRUMB_NO
    ,OAWebBeanConstants.IGNORE_MESSAGES);
    AM Code
    public void initUpdateECDetails(String request_number,String supplier_id,String site_name,String site_id,String notification_method,String fax_number)
    OADBTransaction localOADBTransaction = getOADBTransaction();
    String siteToUpdate;
    siteToUpdate=site_name;
    String siteidToUpdate;
    siteidToUpdate=site_id;
    System.out.println("Site Name to Update or Create is : " + siteToUpdate);
    System.out.println("Site Id to Update or Create is : " + siteidToUpdate);
    System.out.println("Inside Update EC Details MEthod.");
    OAViewObject suppSiteDetVO = getFLPOSSuppSiteDetailsVO1();
    FLPOSSuppSiteDetailsVORowImpl sro=null;
    String existingWhereClause = suppSiteDetVO.getWhereClause();
    suppSiteDetVO.setWhereClause(null);
    suppSiteDetVO.setWhereClauseParams(null);
    suppSiteDetVO.setWhereClause("SUPPLIER_ID = :1 AND REQUEST_NUMBER = :2 AND SITE_ID = :3 ");
    suppSiteDetVO.setWhereClauseParam(0, supplier_id);
    suppSiteDetVO.setWhereClauseParam(1, request_number);
    suppSiteDetVO.setWhereClauseParam(2, site_id);
    suppSiteDetVO.executeQuery();
    suppSiteDetVO.setWhereClauseParams(null);
    suppSiteDetVO.setWhereClause(existingWhereClause);
    int rowcount = suppSiteDetVO.getRowCount();
    System.out.println("Fetched Rows : " + rowcount);
    if (rowcount == 0) {
    Row row = suppSiteDetVO.createRow();
    System.out.println("Row is : " +row);
    suppSiteDetVO.insertRow(row);
    String siteId = getOADBTransaction().getSequenceValue("FLPOS_SITE_ID_SEQ").toString();
    System.out.println("New Site ID : " + siteId);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    row.setAttribute("RequestNumber", request_number);
    row.setAttribute("SupplierId", supplier_id);
    row.setAttribute("SiteName", site_name);
    row.setAttribute("SiteId", siteId);
    row.setAttribute("FaxNo",fax_number);
    row.setAttribute("NotificationMethod",notification_method);
    System.out.println("New Row Created for Supplier Site.");
    System.out.println("Data Saved to table.");
    else{
    System.out.println("Inside Else Block ");
    try {
    System.out.println("Inside Try Block ");
    Row[] row = suppSiteDetVO.getAllRowsInRange();
    for (int i = 0; i < rowcount; i++) {
    sro = (FLPOSSuppSiteDetailsVORowImpl)row;
    String psiteName=sro.getSiteName();
    Number psiteid=sro.getSiteId();
    System.out.println(" p Site Name is : " +psiteName);
    System.out.println(" p site id is " +psiteid);
    if(psiteid.equals(siteidToUpdate) ) {
    sro.setAttribute("FaxNo",fax_number);
    sro.setAttribute("NotificationMethod",notification_method);
    //getOADBTransaction().commit();
    break;
    catch (Exception e) {
    System.out.println("Exception in update : " + e);
    }

    Please answer following:
    1. Are you using EO based VOs or ReadOnly VO?
    2. What is your VO Query for the search and update?
    3. Why have you based your logic on site_name; you should have used site_id?
    4.Are you getting correct site name in handling createECdetailsEvent event in CO?
    5. In case of update are you getting correct values on the Update Site Details?
    6. On coming back from Update page to Supplier Site Search page, do you see old values of the site or the new values in the results table?
    Please share the screenshot if possible.
    -Prince
    [email protected]
    http://princekapoor82.blogspot.com

  • Looping SelectedItem values in HttpService to Update Several Rows in Database in Flex

    Hi,
    My client wanted me to create something that allows certain
    DataGrid to display to allow users to edit and update the database
    records. The only dilemma I am having here is how to actually
    create something from Flex's end to allow users update several rows
    of the database at once. Since everything in my datagrid would be
    defined as selectedItem whenever a user accesses the entry, how can
    I get Flex to recognize each of the updated variables while I
    update the database?
    Another question is, if I do something like
    dg2.selectedItem.id, it would only display the "selectedItem," and
    since I intend to loop every single one of the values as such in
    the datagrid to be updated, is it possible to do something like dg.
    .id? I tried to do this, and I kept on getting errors.
    If anyone could refer me to some examples on how to get this
    to start, it would be great.
    Thanks in advance.
    Alice
    This is the current code I have:
    <mx:HTTPService id="save_scenario" method="POST" url="
    http://localhost/save_scenario.php"
    useProxy="false">
    <mx:request xmlns="">
    <scenario_name>{scenario_name}</scenario_name>
    <id_no>{dg2.selectedItem.id}</id_no>
    <region_name>{dg2.selectedItem.region_name}</region_name>
    <population>{dg2.selectedItem.population}</population>
    <market>{dg2.selectedItem.market}</market>
    </mx:request>
    </mx:HTTPService>

    Thanks, but I think I will be a little more explicit here
    about what I really wanted to know. My impression is that if I have
    a DataGrid and that I would like to allow users to edit certain
    entries within the actual grid and have all of it saved to the
    database, I could use a for loop and just update everything without
    paying attention to what has really been updated, but I have been
    struggling with how to pass it all to the variables side.
    Currently, I could update things one entry a time, by using the
    code I provided earlier, but is there a way of which I can have it
    all posted to the HTTPService in one go?
    Note: I tried using dg.
    .id_no in the for loop to iterate over the variables I intend to
    post, but I don't think I am allowed to do so, do I?
    Alice
    Attached is what I used in a PHP script to allow the code
    loop around the users' edits, how could I do the similar thing in
    Flex by assigning the index variable to something more dynamic?
    Attach Code
    <?php
    if(!isset($_POST['npop'])){
    // this is where the user will select how many pops to insert
    ?>
    <form method="post">
    <input type="text" name="npop" value="Type in how many
    post values">
    <input type="submit" value="Continue">
    </form>
    <?
    } else {
    if(!isset($_POST['pop'])){
    $pop = $_POST['npop'];
    // when the user has selected the N number of pops
    // its time to create the N input elements
    ?>
    <form method="post">
    <input type="hidden" name="npop"
    value="<?=$pop;?>">
    <input type="hidden" name="pop" value="0">
    <?
    for($i = 1;$i <= $pop; $i++){
    echo "<h3>Pop $i</h3>";
    // now comes the 5 input elements..
    // add them as u like naming them in the following pattern,
    // or whatever prefix
    ?>
    Market: <input type="text" name="a<?=$i;?>"
    value="0"><br />
    IM_accept: <input type="text" name="b<?=$i;?>"
    value="0"><br />
    IM_defer: <input type="text" name="c<?=$i;?>"
    value="0"/><br />
    CR_accept : <input type="text" name="d<?=$i;?>"
    value="0"><br />
    FC_accept : <input type="text" name="e<?=$i;?>"
    value="0"><br />
    <?
    ?>
    <input type="Submit" value="Submit form">
    </form>
    <?
    } else {
    $pop = $_POST['npop'];
    // when the user has submitted the pops,
    // they will be inserted to N rows in the table.
    for($i = 1; $i <= $pop; $i++){
    $a = $_POST['a'.$i]; $b = $_POST['b'.$i]; $c =
    $_POST['c'.$i];
    $d = $_POST['d'.$i]; $e = $_POST['e'.$i];
    $sql = "insert INTO table VALUES('$a', '$b', '$c', '$d',
    '$e')" . "\n";
    echo $sql;
    $myFile = "testFile.txt";
    $fh = fopen($myFile, 'a') or die("can't open file");
    fwrite($fh, $sql);
    fclose($fh);
    echo "POPs were recorded. Thank you";
    ?>

  • Finding all rows based on previous rows column value diffrence

    I have an interesting requirement. There is a DATE column and a user in a table and I have to find all rows for all the user for which the previous row and current row has time difference of lets say more than 30 minutes. Rows are already sorted by time.
    For example in the following table, we need ID 4 and 6 for user 1.
    ID User date
    1 1 today 1 hour 0 min 0 s
    2 1 today 1 hour 1 min 0 s
    3 1 today 1 hour 29 min 0 s
    *4 1 today 1 hour 59 min 3 s*
    5 1 today 2 hour 10 min 2 s
    *6 1 today 2 hour 50 min 7 s*
    Edited by: user733179 on Mar 5, 2009 12:00 PM

    Hi,
    To get all the users in the result set, outer-join to a table (or subquery, as shown bleow) that has one row per user:
    WITH     got_dif     AS
         SELECT     id,     dt,     usr
         ,     (dt - LAG (dt)
                    OVER ( PARTITION BY  usr
                              ORDER BY          dt
              )             -- difference in days
                  * 24 * 60  AS minutes_dif
         FROM     table_x
    --     WHERE     ...     -- if needed
    ,     all_users     AS
         SELECT DISTINCT  usr
         FROM              table_x
    SELECT     gd.id,     gd.dt,     au.usr
    ,     NVL2 ( gd.usr
              , 'Okay'
              , 'Dif is never > 30'
              )    AS flag
    FROM          all_users
    LEFT OUTER JOIN     got_dif          ON  gd.usr         = au.usr
                                AND gd.minutes_dif > 30
    ;Notice that the test for a 30-minute difference is part of the join condition.
    You don't need the flag column, and you may not want it.
    If you would prefer a separate query of just the users that are not in the original result set, then you can use the original query (modified only slightly) as an EXISTS ior NOT IN sub-query. For example:
    SELECT DISTINCT     usr
    FROM    table_x
    WHERE   usr  NOT IN
         WITH     got_dif     AS
              SELECT     id,     dt,     usr
              ,     (dt - LAG (dt)
                             OVER ( PARTITION BY  usr
                                      ORDER BY          dt
                    )             -- difference in days
                        * 24 * 60  AS minutes_dif
               FROM     table_x
    --          WHERE     ...     -- if needed
         SELECT  usr   -- Only 1 column in SELECT clause
         FROM     got_dif
         WHERE     minutes_dif     > 30
    ;

  • FORCE TO "Update document rows to new BP's data"

    How do I force to respond YES in the dialog box "Update document rows to new BP's data?" shows, when I DUPLICATE a marketing document?
    Edited by: Gabriel Marroquin on Sep 25, 2008 6:46 PM

    I want that the user dosen´t have the option to answer NO, that´s I need that the answer always be YES. (If a sales user DUPLICATE an old quotation, wich has a lower price than the actual price of an article, and he answer NO, the actual price of the article doesn´t refresh and the company loose money.)

  • Add / Delete a row in a table without using a button

    Hi,
    I was just wondering if it was possible to remove or add a row in a table without using the button?  I noticed that in all examples, it always involve putting code in the button click event but I wanted to add or delete a row in a table based on the fact if the row contains a certain value or not.  Is that possible?
    Much appreciated,
    Vincent

    Vincent,
         Here is the updated file..
    https://acrobat.com/#d=bVDBNM0pnS2IpfE58V01Tg
    You have checked the checkbox "Repeat subform for each Row" for Header Row under IndTable1. You need to do at Row1 level of Table1.
    I bound the Row1 of Table1 to <Row1> tag in your XML which can repeat multiple times.
    I wrote the code in the Doc Ready event of the Test1 field to check whether the value is existing or not. If it does not have a value, then I am removing the instance of the Row1 by passing the current index.. (You can check the code)..
    While creating a data connection using XML you need to make sure that the below structure is repeated atleast 2 times. And while previewing you can use make a copy of this same XML and remove Row1.
      <Row1>
        <Test1>Individual Name 1</Test1>
      </Row1>
    Thanks
    Srini

  • Is it possible to insert row with timestamp field without to TO_TIMESTAMP

    hello
    is it possible to insert row with timestamp column without using to_timestamp unction
    somthing like insert into app.master values (3,333, 'inser tmstmp', 6.7, '2010-11-10 15:14', 'f','9','2010-12-22')

    784633 wrote:
    hello
    is it possible to insert row with timestamp column without using to_timestamp unction
    somthing like insert into app.master values (3,333, 'inser tmstmp', 6.7, '2010-11-10 15:14', 'f','9','2010-12-22')If you don't like the answers in your previous thread (Re: how can i set timestamp format don't expect to get different answers just because you start a new thread.

Maybe you are looking for