Validated Previous row data

Hi,
I need to validate the cell in my application using raise application error's
My Requirement is like this
There are 4 Columns
"Incoming", "Design", "Build","Test","Release"
non of the previous phase must be null, if any of the previous phase is null it must trough a error. I am trying to do like this using a if statement
wwv_flow.g_f04(vRow)) //Incoming
to_number(wwv_flow.g_f05(vRow)) //Design
to_number(wwv_flow.g_f06(vRow)) //Build
to_number(wwv_flow.g_f07(vRow)) //Test
to_number(wwv_flow.g_f08(vRow)) //Release
IF to_number(wwv_flow.g_f04(vRow)) IS NULL AND to_number(wwv_flow.g_f05(vRow)) IS NOT NULL Then
RAISE_APPLICATION_ERROR(-20000,'Previous Phase Incoming-Doc is null, Cannot Proceed Furthere');
END IF;
but this will take to lot of condition how to validate this please suggest
Thanks
Sudhir

Sudhir
If the values were in an array (based at 1, finish at N>1), you want a loop like this (I have used an array called x() for simplicity). This approach is also easy to scale to 10, 20 or 1000 stages:
for i in 1..n loop
  if x(i) is null and x(i+1) is not null then
     RAISE_APPLICATION_ERROR(-20001, ,'Phase '|| phase_name(i+1) ' is set and previous phase ' || phase_name(i) || ' is null, Cannot Proceed Further');
  end if;
end loop;Note that this finds the first transition from null to set; it doesn't try to show all the values that should have been set:
Incoming: set
Design: null
Build: null:
Test: set
Release: set
The error message would be "Phase Test is set and previous phase Build is null ..." - no mention of the Design phase. Of course you could easily build a string that told you ALL previous null sets.
HTH
Regards Nigel

Similar Messages

  • How to propogate previous row value

    All,
    I have a query were I need to fill the null data with previous row value. Like I have a table were we record all the On hand quantity for a item for a date. Lets say I have only 2 rows in this table for a month then I am planning to write a view that will give me 31/30 rows for a month and if for a specific date is the value is null then it should read from previous row unitl it finds the data otherwise display 0.
    Ex. Actual table
    Item No Date Qty
    1 1/1/2010 10
    1 1/5/2010 15
    View I have written, I need to fill the null Qty with previous row data
    Item No Date Qty
    1 1/1/2010 10
    1 1/2/2010
    1 1/3/2010
    1 1/4/2010
    1 1/5/2010 15
    1 1/6/2010
    I want something like this how can i do this?
    Item No Date Qty
    1 1/1/2010 10
    1 1/2/2010 10
    1 1/3/2010 10
    1 1/4/2010 10
    1 1/5/2010 15
    1 1/6/2010 15
    Thanks

    Hi Sung, sorry by my delay
    Basically I'm building a Client Framework that a lot of actions are automatically managed, then I extend Objects
    for example EntityImpl. I let to user set any value to the
    database mapped fields but I will check this values
    using my own bussines rules before to insert into database
    and if this values are wrong I display an alert.
    My problem is that I catch insert event to call validate
    functions. But when any value is wrong I will show an alert, but if user commits transaction after validate
    funcion is not revalidated. Well I supose that is a bad implementation for validation rules, now amb reading about
    Validationlistener because I think is the best way to do
    all that I need. I let to the user add field values but
    these values not will commited while validationListeners
    return isValid = true;
    Thanks Sung.
    Albert.

  • Find Previous row

    Hi All,
    Pls tell me how to find previous row data according to specific condition as follows,
    my table structure like this
    ID NAME SAL
    7 pp 500
    1 aa 100
    2 bb 200
    3 cc 300
    4 dd 400
    1 gg 400
    2 pp 500
    5 qq 700
    1 ql 900
    8 ql 900
    9 al 900
    1 al 700
    I want to select only previous row which is before id 1.
    I want result like this .
    ID NAME SAL
    7 pp 500
    4 dd 400
    5 qq 700
    9 al 900
    Pls help me.
    Thanks & Regards,

    Hi,
    SQL> SELECT * FROM t;
            ID NAME                        SAL
             7 pp                          500
             1 aa                          100
             2 bb                          200
             3 cc                          300
             4 dd                          400
             1 gg                          400
             2 pp                          500
             5 qq                          700
             1 ql                          900
             8 ql                          900
             9 al                          900
            ID NAME                        SAL
             1 al                          700
    12 rows selected.
    SQL> SELECT * FROM t
      2  WHERE  (id) IN (
      3  SELECT id_1 FROM (
      4  SELECT  id,lag(id,1) over (order by 1) id_1 FROM t
      5  ) WHERE id = 1
      6  )
      7  /
            ID NAME                        SAL
             4 dd                          400
             5 qq                          700
             7 pp                          500
             9 al                          900
    SQL>Regards

  • DAX - how to use dax to return a previous row value?

    Hi,
    I was trying to use the EARLIER function but couldn't make it work:
    EVALUATE
    SUMMARIZE (
    CALCULATETABLE (
    'Inscricoes',
    'Ano Letivo'[ID_TB_DIM_ANO_LETIVO] <= VALUE(26),
    'Ano Letivo'[ID_TB_DIM_ANO_LETIVO] > VALUE(26) - 5,
    'Escola'[ID_TB_DIM_UNIDADE_ORGANICA] = VALUE(6),
    Curso[ID_TB_DIM_CURSO] = VALUE(372),
    'Tipo de Inscricao no Curso'[DS_TIPO_INSCRICAO_CURSO]
    = "Matrícula"
    'Ano Letivo'[ID_TB_DIM_ANO_LETIVO],
    'Ano Letivo'[DS_ANO_LETIVO],
    "NR_INSCRICOES", [NR_ESTUDANTES_INSCRITOS])
    This generates:
    ID_TB_DIM_ANO_LETIVO
    DS_ANO_LETIVO
    NR_INSCRICOES
    22
    2010-11
    93
    23
    2011-12
    101
    24
    2012-13
    84
    25
    2013-14
    85
    26
    2014-15
    104
    I need a new field that does returns the previous value of subscriptions (NR_INSCRICOES), so last 2 columns will be:
    93 - 
    101 - 93
    84 - 101
    85 - 84
    104 - 85
    Need some help. Thanks

    Hi Pedro,
    According to your description, you want to get the previous row data along with each row. Right?
    In DAX, we can use EARLIER() function to achieve this requirement. Please refer to link below:
    PowerPivot DAX Session Notes 2 – Previous Row
    In this scenario, I suggest you select the three columns into one table(let's say TABLE1). Then you can try the expression below:
    =CALCULATE(MAX(TABLE1[NR_ESTUDANTES_INSCRITOS]), (FILTER(TABLE1,EARLIER(TABLE1[ID_TB_DIM_ANO_LETIVO])>TABLE1[ID_TB_DIM_ANO_LETIVO])))
    Reference:
    EARLIER Function (DAX)
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Refer to previous row's data

    Is it possible to refer to a previous row's data inside
    spry:if? Something like spry:if=" '{sampleDS::ds_RowID[this -
    1]::category/@name}'= '{sampleDS::category/@name}' "
    Right now I have to store the part I want compared in a JS
    variable.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml"
    xmlns:spry="
    http://ns.adobe.com/spry">
    <head>
    <title>Sample</title>
    <script type="text/javascript" language="javascript"
    src="scripts/SpryData.js"></script>
    <script type="text/javascript" language="javascript"
    src="scripts/xpath.js"></script>
    <script type="text/javascript" language="javascript">
    <!--
    var sampleDS = new Spry.Data.XMLDataSet("sample.xml",
    "/programs/program", {sortOnLoad: ['category/@name', 'title']});
    sampleDS.loadData();
    var prevCat = new String;
    var thisCat = new String;
    -->
    </script>
    </head>
    <body>
    <div spry:region="sampleDS">
    <div spry:repeat="sampleDS">
    <h1 spry:if="prevCat = thisCat; thisCat =
    '{sampleDS::category/@name}'; thisCat != prevCat"
    >{sampleDS::category/@name}</h1>
    <h2>{sampleDS::title}</h2>
    </div>
    </div>
    </body>
    </html>
    sample.xml:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <programs>
    <program id="5">
    <category id="2" name="Category 2" />
    <title>Program E</title>
    </program>
    <program id="2">
    <category id="1" name="Category 1" />
    <title>Program B</title>
    </program>
    <program id="4">
    <category id="1" name="Category 1" />
    <title>Program D</title>
    </program>
    <program id="3">
    <category id="1" name="Category 1" />
    <title>Program C</title>
    </program>
    <program id="1">
    <category id="2" name="Category 2" />
    <title>Program A</title>
    </program>
    </programs>
    Thanks,
    Andrew

    Thanks, that's a lot cleaner than what I had.
    var sampleDS = new Spry.Data.XMLDataSet("sample.xml",
    "/programs/program", {sortOnLoad: ['category/@name', 'title']});
    var categoryDS = new Spry.Data.XMLDataSet("sample.xml",
    "/programs/program/category", {distinctOnLoad: true, sortOnLoad:
    '@name'});
    sampleDS.loadData();
    <div spry:region="sampleDS categoryDS">
    <div spry:repeat="categoryDS">
    <h1>{categoryDS::@name}</h1>
    <h2 spry:repeat="sampleDS"
    spry:test="'{categoryDS::@name}' ==
    '{sampleDS::category/@name}'">{sampleDS::title}</h2>
    </div>
    </div>

  • Display only data different from the previous row

    Hello,
    I will use a simple example to explain what I would like to do with a query.
    I have a table 'test' with 4 columns (col1, col2, col3, col4).
    The table 'test' contains the following data:
    A  B  C  D
    A  E  C  D
    A  F  G  D
    K  F  G  HI would like to create a query ordered on the first column with the following result:
    A  B  C  D
       E
       F  G
    K        HOnly data that are different from the previous row have to be displayed.
    Do you have ideas on how to do this.
    Thanks for your help

    SQL> l
      1  select
      2  decode(a,lag(a) over (order by a),null,a) a,
      3  decode(b,lag(b) over (order by a),null,b) b,
      4  decode(c,lag(c) over (order by a),null,c) c,
      5  decode(d,lag(d) over (order by a),null,d) d
      6  from
      7  (
      8  select 'A' a,'B' b,'C' c , 'D' d from dual
      9  union
    10  select 'A' a,'E' b,'C' c , 'D' d from dual
    11  union
    12  select 'A' a,'F' b,'G' c , 'D' d from dual
    13  union
    14  select 'K' a,'F' b,'G' c , 'H' d from dual
    15* )
    SQL> /
    A B C D
    A B C D
      E
      F G
    K     H

  • How to get the value of column from previous row to current row?

    Hi All,
    I am facing a critical problem in SQL query (for reporting purpose (COGNOS)). please reply to my query.
    REQUIREMENT: i want to retrive value of a column (this is not a table column, this will be calculated based expression) from previous row to current row.
    EXAMPLE:
    TABLE NAME: i have to join multiple tables. so, i am not mentioning table names here.
    DISPLAY COLUMNS in the report: item, loc, sku, beginval (not table column), endval (not table column, this will calculated based on some expressions), etc. Here, first time the value of BEGINVAL will be taken from some x column name of x table. ENDVAL will calculated based on the expression. For the next row onwards, BEGINVAL will become the value of ENDVAL and the value of ENDVAL will be calculated based on the expression and this expression uses the value of BEGINVAL.
    my report will look like below.
    ITEM LOC SKU BEGINVAL ENDVAL
    1 HYD 1-HYD 10 10+1+2 (13)
    2 HYD 2-HYD 13 13+1+2 (16)
    3 SEC 3-SEC 16 16+1+2 (19)
    4 SEC 4-SEC 19 19+1+2 (22)
    etc....
    in the above output, BEGINVAL and ENDVAL columns are not part of any table. they are alias column names.if you observe intially BEGINVAL will be assigned to some value, but from subsequent rows, BEGINVAL will become the ENDVAL of previous row.
    Please help me on how to write this query?

    Hi, please find the detail description of the problom.
    DDL (table scripts)
    ITEM
    CREATE TABLE ITEM
    ITEM VARCHAR2(50 CHAR) NOT NULL,
    DESCR VARCHAR2(50 CHAR) DEFAULT ' ' NOT NULL,
    UOM           VARCHAR2(50 CHAR)
    SKU
    CREATE TABLE SKU
    ITEM VARCHAR2(50 CHAR) NOT NULL,
    LOC VARCHAR2(50 CHAR) NOT NULL,
    OH float
    SKUPROJSTATIC
    CREATE TABLE SKUPROJSTATIC
    ITEM VARCHAR2(50 CHAR) NOT NULL,
    LOC VARCHAR2(50 CHAR) NOT NULL,
    STARTDATE DATE
    VehicleLoad
    CREATE TABLE VEHICLELOAD
    LOADID VARCHAR2(50 CHAR) NOT NULL,
    DESCR VARCHAR2(50 CHAR) DEFAULT ' ' NOT NULL,
    SHIPDATE DATE DEFAULT TO_DATE('01/01/1970','MM/DD/YYYY') NOT NULL,
    ARRIVDATE      DATE
    VEHICLELOADLINE
    CREATE TABLE VEHICLELOADLINE
    LOADID VARCHAR2(50 CHAR) NOT NULL,
    ITEM VARCHAR2(50 CHAR) NOT NULL,
    QTY float(126)
    DML scripts
    I can't provide the the DML scripts, because its very huge data.
    Main QUERY is below.
    below is the query which i have to write and execute.
    select
    i.item,
    i.descr,
    i.unitsperpallet,
    sp.loc,
    sp.startdate,
    'Crucial_IND',
    LAG (EndBal,1,0) OVER (ORDER BY STARTDATE) BeginBal,
    SP.FCSTCUSTORDERS CustOrders,
    SP.COMMITINTRANSOUT,
    SP.RECARRIV,
    SP.TOTINTRANSIN,
    (BeginBal - sp.FCSTCUSTORDERS - sp.COMMITINTRANSOUT + sp.TOTINTRANSIN ) EndBal,
    'CuttingQty',
    VLL.QTY,
    vl.source,
    vl.arrivdate,
    vl.shipdate,
    vl.loadid,
    s.oh
    from item i, skuprojstatic sp, sku s, VehicleLoad vl, VehicleLoadLine vll
    where sp.item = i.item
    and s.item=i.item
    and sp.item =s.item (+)
    and sp.loc = s.loc (+)
    and vll.item = s.item
    and vll.loadid = vl.loadid
    and to_char(sp.startdate ,'mm/dd/yyyy') = to_char(vl.arrivdate,'mm/dd/yyyy')
    and sp.loc = vl.dest (+)
    order by sp.startdate
    problem description: in the above query, BeginBal and EndBal is what i am looking for. when i execute this query, oracle throwing an error saying that alias names can't be used as expressions. For the first row, the BeginBal should be the value sku.OH and for the subsequent rows, this value will be the previous row value of EndBal.

  • 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>

  • Difference between current row and previous row in a table

    Hi All,
    I am having a problem with the query. Can some of please help me?
    I need to get difference between current row and previous row in a table. I have a table, which have data like bellow.
    TABLEX
    ================
    Name Date Items
    AAA 01-SEP-09 100
    BBB 02-SEP-09 101
    CCC 03-SEP-09 200
    DDD 04-SEP-09 200
    EEE 05-SEP-09 400
    Now I need to get output like bellow...
    Name Date Items Diff-Items
    AAA 01-SEP-09 100 0
    BBB 02-SEP-09 101 1
    CCC 03-SEP-09 200 99
    DDD 04-SEP-09 200 0
    EEE 05-SEP-09 400 200
    Can some one help me to write a query to get above results?
    Please let me know if you need more information.
    Thanks a lot in advance.
    We are using Oracle10G(10.2.0.1.0).
    Thanks
    Asif

         , nvl (items - lag (items) over (order by dt), 0)like in
    SQL> with test as
      2  (
      3  select 'AAA' name, to_date('01-SEP-09', 'dd-MON-rr') dt,  100 items from dual union all
      4  select 'BBB' name, to_date('02-SEP-09', 'dd-MON-rr') dt,  101 items from dual union all
      5  select 'CCC' name, to_date('03-SEP-09', 'dd-MON-rr') dt,  200 items from dual union all
      6  select 'DDD' name, to_date('04-SEP-09', 'dd-MON-rr') dt,  200 items from dual union all
      7  select 'EEE' name, to_date('05-SEP-09', 'dd-MON-rr') dt,  400 items from dual
      8  )
      9  select name
    10       , dt
    11       , items
    12       , nvl (items - lag (items) over (order by dt), 0)
    13    from test
    14  ;
    NAM DT             ITEMS NVL(ITEMS-LAG(ITEMS)OVER(ORDERBYDT),0)
    AAA 01-SEP-09        100                                      0
    BBB 02-SEP-09        101                                      1
    CCC 03-SEP-09        200                                     99
    DDD 04-SEP-09        200                                      0
    EEE 05-SEP-09        400                                    200
    SQL>

  • Validation on Integer data type attribute

    Hi,
    Working on jdev 11.1.1.3.0
    I have to do validation on integer data type like, it should not allow 13.20(only single digit numbers.).
    I am doing validation on AMImpl and converting the int into string
    String per=Row.getPer().toString();// here if user enter 13.20, then per containing only 13 so its not going to inside if.
    if(StringUtils.contains(per,"."))
    return false;
    Even i have written regular expression on my field but its working
    can any one help me.

    Hi,
    Why don't you use the af:convertNumber in your tag?
    Something like that:
    <af:inputText>
    <af:convertNumber>
    </af:inputText>
    Doc: http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e12419/tagdoc/af_convertNumber.html
    Regards,

  • Previous Available date in a column

    I Have a colum date and a amount. If select a date i need to fetch the previous avaialble amount
    In the below case
    WITH table_1 AS
    (select '700' amount,'01/01/2011' date1 from dual union all
    select '800' amount ,'12/23/2010' date1 from dual union all
    select '900' amount, '11/31/2011' date1 from dual
    select * from table_1;
    if my where clause for date = '12/23/2010' then the amount should be '0' as no previous day amount avaialble.
    if my where clause for date = '01/01/2011' then the amount should be '800' as the avaialble previous date is '12/23/2010'
    if my where clause for date = '11/31/2011' then the amount should be '700'' as the avaialble previous date is '01/01/2011'
    Please help
    Edited by: user10285699 on Jan 24, 2011 5:47 PM

    Hi,
    user10285699 wrote:
    ... WITH table_1 AS
    select '1' day, '10' id1,'100' amount,'12/30/2010' date1,'null' amount_pre_day from dual union all
    select '1' day,'20' id1 ,'200' amount , '12/20/2010' date1 ,'null' amount_pre_day from dual union all
    select '1' day, '30' id1, '300' amount, '10/28/2011' date1,'null' amount_pre_day from dual
    select * from table_1;
    The second day i need to calculate the previous AVAILABLE day amount and update another column "amount_pre_day"
    WITH table_1 AS
    (select '2' day, '10' id1,'400' amount,'12/31/2010' date1, '100' amount_pre_day from dual union all
    select '2' day, '20' id1 ,'500' amount ,'12/22/2010' date1,'200' amount_pre_day from dual union all
    select '2' day, '30' id1, '600' amount, '10/31/2011' date1,'300' amount_pre_day from dual
    select * from table_1;
    The tihrd day i need to calculate the previous AVAILABLE day amount and update another column "amount_pre_day"
    WITH table_1 AS
    (select '3' day, '10' id1,'700' amount,'01/01/2011' date1, '400' amount_pre_day from dual union all
    select '3' day, '20' id1 ,'800' amount ,'12/23/2010' date1,'500' amount_pre_day from dual union all
    select '3' day, '30' id1, '900' amount, '11/31/2011' date1,'600' amount_pre_day from dual
    select * from table_1;Thanks for posting the sample data.
    Always post the results you want from the sample data, too, and say what version of Oracle you're using.
    Are those 3 different sets of sample data? I'm very confused by what you want.
    Why is everything a string, including the word 'null'? In particular, it's a really bad idea to store dates in VARCHAR2 columns; you should use a DATE column instead.
    What date is '11/31/2011' supposed to be?
    My best guess as to what you mean is:
    "I have the following table:
    {code}
    WITH table_1 AS
    select '1' day, '10' id1, '100' amount, DATE '2010-12-30' date1, null amount_pre_day from dual union all
    select '1' day, '20' id1, '200' amount, DATE '2010-12-20' date1, null amount_pre_day from dual union all
    select '1' day, '30' id1, '300' amount, DATE '2011-10-28' date1, null amount_pre_day from dual union all
    select '2' day, '10' id1, '400' amount, DATE '2010-12-31' date1, '100' amount_pre_day from dual union all
    select '2' day, '20' id1, '500' amount, DATE '2010-12-22' date1, '200' amount_pre_day from dual union all
    select '2' day, '30' id1, '600' amount, DATE '2011-10-31' date1, '300' amount_pre_day from dual union all
    select '3' day, '10' id1, '700' amount, DATE '2011-01-01' date1, '400' amount_pre_day from dual union all
    select '3' day, '20' id1, '800' amount, DATE '2010-12-23' date1, '500' amount_pre_day from dual union all
    select '3' day, '30' id1, '900' amount, DATE '2011-11-30' date1, '600' amount_pre_day from dual
    {code}
    But I don't actually want to supply the amount_pre_day column; I want to compute that from the amount column of the previous row (where date1 determines what that means) for the same id1."
    If that's what you meant, here's one way to get it:
    SELECT       t.*
    ,       LAG (amount) OVER ( PARTITION BY  id1
                                  ORDER BY         date1     -- or maybe day
                       )               AS calc_pre_day
    FROM       table_1   t
    ORDER BY  id1
    ,            date1
    ;Output:
    D ID AMO DATE1       AMO CAL
    1 10 100 30-Dec-2010
    2 10 400 31-Dec-2010 100 100
    3 10 700 01-Jan-2011 400 400
    1 20 200 20-Dec-2010
    2 20 500 22-Dec-2010 200 200
    3 20 800 23-Dec-2010 500 500
    1 30 300 28-Oct-2011
    2 30 600 31-Oct-2011 300 300
    3 30 900 30-Nov-2011 600 600As you can see, the last column (calc_pre_day) is the same as amount_pre_day.

  • Validator error - Extra data was encountered.

    Hi All,
    I am working on Outbound EDI870, getting below Error:
    2010.06.03 at 04:33:34:988: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (ERROR) Error -: B2B-51505: General validation error.
         at oracle.tip.b2b.document.edi.EDIDocumentPlugin.processOutgoingDocument(EDIDocumentPlugin.java:2539)
         at oracle.tip.b2b.msgproc.Request.outgoingRequestPostColab(Request.java:1279)
         at oracle.tip.b2b.msgproc.Request.outgoingRequest(Request.java:790)
         at oracle.tip.b2b.engine.Engine.processOutgoingMessageImpl(Engine.java:1201)
         at oracle.tip.b2b.engine.Engine.processOutgoingMessage(Engine.java:713)
         at oracle.tip.b2b.engine.Engine.handleMessageEvent(Engine.java:2754)
         at oracle.tip.b2b.engine.Engine.processEvents(Engine.java:2444)
         at oracle.tip.b2b.engine.ThreadWorkExecutor.processEvent(ThreadWorkExecutor.java:464)
         at oracle.tip.b2b.engine.ThreadWorkExecutor.run(ThreadWorkExecutor.java:180)
         at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:77)
         at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:171)
         at java.lang.Thread.run(Thread.java:619)
    2010.06.03 at 04:33:34:988: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) Engine: processOutgoingMessageImpl: B2BDomainException
    2010.06.03 at 04:33:34:988: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.engine.Engine:handleOutboundException Updating Error Message: Error -: B2B-51505: General validation error.
    2010.06.03 at 04:33:34:988: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) DbAccess:updateWireBusinessToErrorState
    2010.06.03 at 04:33:34:988: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Enter
    2010.06.03 at 04:33:34:989: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: queryById: Enter
    2010.06.03 at 04:33:34:989: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: queryById: Got RTP Context
    2010.06.03 at 04:33:35:006: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: queryById: Got 1messages for field messageId with value 1410017
    2010.06.03 at 04:33:35:007: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: queryById: Exit
    2010.06.03 at 04:33:35:007: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: findWireMessageByB2BMessageId: querying for id = 1410017
    2010.06.03 at 04:33:35:007: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: findWireMessageByB2BMessageId: Returning null
    2010.06.03 at 04:33:35:007: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Wire message not found.
    2010.06.03 at 04:33:35:008: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Updating business message error information
    2010.06.03 at 04:33:35:008: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: updateObject: Enter:
    2010.06.03 at 04:33:35:008: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: updateObject: Got RTP Context
    2010.06.03 at 04:33:35:008: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: updateObject: Exit
    2010.06.03 at 04:33:35:009: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:updateAppMessageState Enter
    2010.06.03 at 04:33:35:009: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: getAppMessageById: Enter appMsg id = 7F000001128FCF1A4C600000EA6A8D00
    2010.06.03 at 04:33:35:009: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: getAppMessageById: Got RTP Context
    2010.06.03 at 04:33:35:012: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: getAppMessageById: Got [1] messages for AppMessage ID 7F000001128FCF1A4C600000EA6A8D00
    2010.06.03 at 04:33:35:012: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: getAppMessageById: Exit
    2010.06.03 at 04:33:35:013: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:setAppMsgErrorInfo Enter
    2010.06.03 at 04:33:35:013: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:setAppMsgErrorInfo Setting AppMessage to ERROR
    2010.06.03 at 04:33:35:013: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:setAppMsgErrorInfo Exitr
    2010.06.03 at 04:33:35:013: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: updateObject: Enter:
    2010.06.03 at 04:33:35:013: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: updateObject: Got RTP Context
    2010.06.03 at 04:33:35:014: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: updateObject: Exit
    2010.06.03 at 04:33:35:014: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:updateAppMessageState Exit
    2010.06.03 at 04:33:35:014: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:DbAccess:updateMsgError(3 params) Enter
    2010.06.03 at 04:33:35:015: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: updateObject: Enter:
    2010.06.03 at 04:33:35:015: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: updateObject: Got RTP Context
    2010.06.03 at 04:33:35:016: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: updateObject: Exit
    2010.06.03 at 04:33:35:016: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:DbAccess:updateMsgError(3 params) Exit
    2010.06.03 at 04:33:35:016: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.engine.Engine:handleOutboundException Updating Native Event Tbl Row
    2010.06.03 at 04:33:35:016: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:updateNativeEvtTblRow Enter
    2010.06.03 at 04:33:35:017: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: queryById: Enter
    2010.06.03 at 04:33:35:017: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: queryById: Got RTP Context
    2010.06.03 at 04:33:35:019: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: queryById: Got 1messages for field messageId with value 1410017
    2010.06.03 at 04:33:35:019: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: queryById: Exit
    2010.06.03 at 04:33:35:019: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: findWireMessageByB2BMessageId: querying for id = 1410017
    2010.06.03 at 04:33:35:019: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.ToplinkHelper: findWireMessageByB2BMessageId: Returning null
    2010.06.03 at 04:33:35:019: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) DbAccess:updateNativeEvtTblRowGot WireMessage with B2BMessage ID 1410017
    2010.06.03 at 04:33:35:020: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.msgproc.DbAccess:
    ** DbAccess:updateNativeEvtTblRow:tip_wireMsg wiremsg not found
    2010.06.03 at 04:33:35:020: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) oracle.tip.b2b.engine.Engine:handleOutboundException notifying App
    2010.06.03 at 04:33:35:020: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) Notification: notifyApp: Enter
    2010.06.03 at 04:33:35:020: oracle.integration.platform.blocks.executor.WorkManagerExecutor$1@8f1195: B2B - (DEBUG) Notification: notifyApp: payload = <Exception xmlns="http://integration.oracle.com/B2B/Exception" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <correlationId>7F000001128FCF1A4C600000EA6A8D00</correlationId>
    <b2bMessageId>1410017</b2bMessageId>
    <errorCode>B2B-51505</errorCode>
    <errorText>
    Error Brief :
    Validator error - Extra data was encountered.
    An X12 syntax error occurred.
    An X12 syntax error occurred.
    Validator error - Extra data was encountered.
    Validator error - Extra data was encountered.
    A data element with 'Mandatory' status is missing.
    </errorText>
    <errorDescription>
    <![CDATA[
    Error :
    Extra Element was found in the data file as part of Segment REF. Segment REF is defined in the guideline at position 046.{br}{br}This error was detected at:{br}{tab}Segment Count: 3{br}{tab}Element Count: 2{br}{tab}Characters: 567 through 575
    At least one of REF02, REF03 must be present. The syntax rule R0203 of Segment REF is violated. Segment REF is defined in the guideline at position 046.{br}{br}This error was detected at:{br}{tab}Segment Count: 3{br}{tab}Element Count: 2{br}{tab}Characters: 593 through 593
    At least one of REF02, REF03 must be present. The syntax rule R0203 of Segment REF is violated. Segment REF is defined in the guideline at position 046.{br}{br}This error was detected at:{br}{tab}Segment Count: 3{br}{tab}Element Count: 3{br}{tab}Characters: 593 through 593
    Extra Element was found in the data file as part of Segment ISR. Segment ISR is defined in the guideline at position 030.{br}{br}This error was detected at:{br}{tab}Segment Count: 6{br}{tab}Element Count: 1{br}{tab}Characters: 870 through 872
    Extra Element was found in the data file as part of Segment ISR. Segment ISR is defined in the guideline at position 030.{br}{br}This error was detected at:{br}{tab}Segment Count: 6{br}{tab}Element Count: 2{br}{tab}Characters: 907 through 915
    Element ISR01 (Shipment/Order Status Code) is missing. This Element's standard option is 'Mandatory'. Segment ISR is defined in the guideline at position 030.{br}{br}This Element was expected in:{br}{tab}Segment Count: 6{br}{tab}Element Count: 1{br}{tab}Character: 933
    ]]>
    </errorDescription>
    <errorSeverity>2</errorSeverity>
    </Exception>
    Even though I am providing REF01 and ISR01 values, I am getting this Error.
    Below is my XML payload.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <Transaction-870 xmlns:ns0="http://www.edifecs.com/xdata/200" Standard="X12" xmlns="http://www.edifecs.com/xdata/200">
    - <ns0:Segment-ST>
    <ns0:Element-143>870</ns0:Element-143>
    <ns0:Element-329>000000043</ns0:Element-329>
    </ns0:Segment-ST>
    - <ns0:Segment-BSR>
    <ns0:Element-850>3</ns0:Element-850>
    <ns0:Element-847>PA</ns0:Element-847>
    <ns0:Element-127>3110000031OTM_TestPR</ns0:Element-127>
    <ns0:Element-373>20100603</ns0:Element-373>
    </ns0:Segment-BSR>
    - <ns0:Loop-REF>
    - <ns0:Segment-REF>
    <ns0:Element-128>VR</ns0:Element-128>
    <ns0:Element-127>RHEEM002</ns0:Element-127>
    </ns0:Segment-REF>
    </ns0:Loop-REF>
    - <ns0:Loop-HL>
    - <ns0:Segment-HL>
    <ns0:Element-628>1</ns0:Element-628>
    <ns0:Element-735>O</ns0:Element-735>
    </ns0:Segment-HL>
    - <ns0:Segment-PRF>
    <ns0:Element-324>OTM_Test</ns0:Element-324>
    </ns0:Segment-PRF>
    - <ns0:Loop-ISR>
    - <ns0:Segment-ISR>
    <ns0:Element-368>PR</ns0:Element-368>
    <ns0:Element-373>20100531</ns0:Element-373>
    </ns0:Segment-ISR>
    </ns0:Loop-ISR>
    </ns0:Loop-HL>
    - <ns0:Loop-HL>
    - <ns0:Segment-HL>
    <ns0:Element-628>2</ns0:Element-628>
    <ns0:Element-735>I</ns0:Element-735>
    </ns0:Segment-HL>
    - <ns0:Loop-PO1>
    - <ns0:Segment-PO1>
    <ns0:Element-350>1</ns0:Element-350>
    <ns0:Element-330>2</ns0:Element-330>
    <ns0:Element-355>EA</ns0:Element-355>
    <ns0:Element-235>SK</ns0:Element-235>
    <ns0:Element-234>6836003</ns0:Element-234>
    <ns0:Element-235_1>VP</ns0:Element-235_1>
    <ns0:Element-234_1>TAHM ITEM</ns0:Element-234_1>
    </ns0:Segment-PO1>
    - <ns0:Segment-PID>
    <ns0:Element-349>F</ns0:Element-349>
    <ns0:Element-352>TAHM ITEM</ns0:Element-352>
    </ns0:Segment-PID>
    </ns0:Loop-PO1>
    </ns0:Loop-HL>
    - <ns0:Segment-CTT>
    <ns0:Element-354>2</ns0:Element-354>
    </ns0:Segment-CTT>
    - <ns0:Segment-SE>
    <ns0:Element-96>11</ns0:Element-96>
    <ns0:Element-329>000000043</ns0:Element-329>
    </ns0:Segment-SE>
    </Transaction-870>
    Thanks in Advance
    Ravdeep

    Hi Ravdeep,
    Have you validated the payload against the ecs using document editor? If no, please do so.
    Also refer -
    5084: XEngine error - Invalid data (outbound with validation disabled)
    Please paste the complete B2B log here/mail it to my id (in my profile)
    Regards,
    Anuj

  • Compare previous row values for the same id and decide

    Hello ,
    I have this sample data
    create table #student_academic
    pk_id int identity(1,1) primary key ,
    student_id int ,
    [year] int,
    [aggr_marks] float
    insert into #student_academic
    student_id ,
    [year] ,
    [aggr_marks]
    values
    (112,2012,55.4),(113,2012,65.4),(114,2012,82.32),
    (112,2013,75.4),(113,2013,91.22),(114,2013,45.45),
    (112,2014,61.2),(113,2014,95.2),(114,2014,75.6)
    select * from #student_academic
    from the above data i have to generate an extra status column. this status column should be decided by comparing the previous row value. the exact output should be like below.
    student_id year aggr_marks Staus----------------------------------------------------------
    112 2012 55.4 None
    112 2013 75.4 Promoted
    112 2014 61.2 Demoted
    113 2012 95.2 None
    113 2013 75.6 Demoted
    113 2014 91.22 Promoted
    113 2012 45.45 None
    113 2013 65.4 Promoted
    113 2014 82.32 Promoted
    is there any way to write the t-sql with out using cursors ? this table has around 25GB of data. Any idea would be appreciated.
    Thanks in advance.

    Hello,
    The difficulty of your example is
    that there are several rows for
    the same year and the same student.
    I present a solution
    if there is
    one line per year per
    student:
    TRUNCATE TABLE #student_academicinsert into #student_academic
    student_id ,
    [year] ,
    [aggr_marks]
    values
    (112,2012,55.4),(113,2012,65.4),(114,2012,82.32),
    (112,2013,75.4),(113,2013,91.22),(114,2013,45.45),
    (112,2014,61.2),(113,2014,95.2),(114,2014,75.6)
    Go
    WITH CTE AS
    (SELECT pk_id, student_id, year, aggr_marks,
    (SELECT TOP 1 aggr_marks FROM #student_academic AS b
    WHERE a.student_id = b.student_id AND a.year -1 = b.year
    ORDER BY student_id) AS prev_aggr_marks
    FROM #student_academic AS a
    SELECT
    pk_id, student_id, year, aggr_marks,
    CASE
    WHEN prev_aggr_marks IS NULL THEN 'None'
    WHEN aggr_marks < prev_aggr_marks THEN 'Demoted'
    WHEN aggr_marks >= prev_aggr_marks THEN 'Promoted'
    END AS Status
    FROM CTE
    ORDER BY student_id, year
    Regards,
    Charlie
    Charlie Dancoisne - Independent Consultant & Trainer (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable. This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • SQL Developer - Pulling column value from previous row

    I am using Oracle SQL developer and trying to pull a value from a column from the previous row.
    Currently this is an example from the code im using.
    Select CD1.nbr_dw, CD1.SEQ_DW, CD1.CDL_NET_PAID, CD1.UNITS_ALLOW,CD1.ALLOW_AMT, CD1.UNIT_PRICE, CD1.BACKED_OUT,
    case
    When CD1.NET_PAID = 0 then 0
    ****NEW CODE*****
    Else CD1.ALLOW_AMT / CD1.UNIT_PRICE
    end as NEW_UNITS
    From Table_A CD1
    join (Select nbr_dw, DET_DW, SEQ_DW
    From Table_B
    ) CD2
    on CD1.nbr_dw = CD2.nbr_dw
    I need to add another when statement that says when CD1.BACKED_OUT = 'Y' populated the NEW_UNITS field with the previous rows value of CD1.UNIT_PRICE. Note, the CD1.SEQ_DW can be used to determine the previous row. Any ideas?

    Hi,
    Welcome to the forum!
    The analytic LAG function can return a value from the previous row:
    LAG (cd1.unit_price) OVER ( -- PARTITION BY  x          -- if needed
                                   ORDER BY          cd1.seq_dw
                     )It's unclear if you need a PARTITION BY clause or not.
    "PARTITION BY x" means that you want the value from the last row that has the same value of x as the current row.
    If you omit the PARTITION BY clause, it means you want the last row regardless of what any other columns are.
    Whenever you have a problem, it ehlps if you post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
    Explain how you get those results from that data.
    Always say what version of Oracle you're using.

  • 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

Maybe you are looking for

  • Use external display only - without mirroring?

    I've seen some folks using a Mac mini as a media center. I have a 12" PB and I was wondering if there's some hack for convincing the PB that there's -only- the external display (let's say 1366x768 or something similar in a wide-screen LCD) so that al

  • Binding a variable to a shared variable is taking the attributes of that variable?

    Is it possible that binding to a shared variable to have the attributes of that variable? With other words shared variable shares attributes also? Thank you, Virginia

  • Tab-like functionality for scrolling?

    Hi all, I need a shortcut (if available). Basically, I want the functionality of the 'tab' key under windows when a pop-up comes up with a choice, I want to hit a key, select the option I want then hit enter to execute that command. Program in questi

  • NTP on clients

    Does an NTP (local) consumer server automatically update the time on all workstations attached to it via client 32, or do any properties need to be set. Peter

  • Ahhh! I need help windows install messed up boot order

    I tried to install windows XP for a work related program I needed to run and the instal did not work. So i went into boot camp and removed the partition and now whenever my imac restarts it tries to boot the removed windows with doesn't work. It tell