Assign a negative value based on the values of phase

Hi all

I have a column called [STAGE] and a column can [Quantity]

My requirement is to fill subsequently in the [Quantity] field.

If [internship] = 10 then - Else [Quantity] + [Quantity]


Pls help...

What have you tried? You can implement a similar technique as your last thread with a CASE statement:

(CASE WHEN STAGE=10 THEN -1*QUANTITY ELSE QUANTITY END)

You can also use DECODE

DECODE(stage,10,-1*QUANTITY,QUANTITY)

Consider reading the [SQL Reference | http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm].

Tags: Database

Similar Questions

  • assign the number to a line based on the analytical condition function

    Oracle 11g Server

    ID val1 val2
    100a
    110 b
    120c
    200a
    220 b

    WITH input AS
     (SELECT 1  id
            ,0  val1
            ,'0a' val2
        FROM dual
      UNION ALL
      SELECT 1  id
            ,1  val1
            ,'0b' val2
        FROM dual
      UNION ALL
      SELECT 1  id
            ,2  val1
            ,'0c' val2
        FROM dual
      UNION ALL
      SELECT 2  id
            ,0  val1
            ,'0a' val2
        FROM dual
      UNION ALL
      SELECT 2     Id
            ,2val1
            ,'0b'    val2
        FROM dual)
    SELECT * FROM input;
    
    !-[CodeBlockEnd:ae52826b-04c5-4aa4-a6c0-1d0405656e55]-->

    Output:

    ID val1 val2 assigned_number
    100a0
    110 b0
    120c2
    200a0
    220 b1

    The dense numbering sequence must be assigned to each line based on the column id and val1.

    For an identifier given, the numbering begins only after val1 > 1 until then the assigned_number will be zero.

    WITH the entry INTO

    (SELECT 1 id)

    0 val1

    '0' has val2

    OF the double

    UNION ALL

    SELECT 1 id

    1 val1

    b '0' val2

    OF the double

    UNION ALL

    SELECT 1 id

    2 val1

    , 0'c ' val2

    OF the double

    UNION ALL

    SELECT 2 id

    0 val1

    '0' has val2

    OF the double

    UNION ALL

    SELECT the Id 2

    2val1

    b '0' val2

    THE DOUBLE)

    SELECT id, val1, val2,

    Rank() over (partition by order of case when val1 > 1 then 0 otherwise end val1) dr-1

    SINCE the entry;

    ID VAL1 IS DR

    ---------- ---------- -- ----------

    1          0 0a          0

    1          1 0b          0

    1          2 0c          2

    2          0 0a          0

    2          2 0b          1

  • Need to display negative amounts, amounts positive based on the value of the parameter.

    Hi all

    I have a requirement in rdf as follows:

    I have two or three lines of the SELECT statement. An amount column having both negative and and postivie values.

    Based on the value of the parameter I need to take these records.

    Say, if the value of the parameter = "Credit amount", then I have to choose the records, the amount column value is negative.

    If the value of the parameter = "Debit amounts" then I have to choose the records, which the column value is positive.

    If the parameter Value = "All", then I must take all records, including both positive and negative.

    Please suggest how to achieve this scenario.

    Thank you
    Abdul

    In your where clause to add the following
    and ((& paramètre = "Débit" et montant > 0) or)
    (& parameter = 'Crédit' and the amount<0)>
    (& parameter = 'All'))

    Hope that answers your question
    Sandeep Gandhi
    Independent consultant
    513-325-9026.

  • How to disable the LOV values based on the State of some?

    Hello

    I have a requirement like this.

    (1) LOV Field (1), when I get a value here then based on the query I get two new values and assign to another two LOV Fields (2,3) and then disable them. However, when I enter the value in the field LOV (1) based on one of the conditions I won't have no default value then LOV fields must be enabled so that the user can select the values of LOV.

    (2) now an another LOV domain (4) when I go here again, then again two fields a LOV (5), and the free text field must be filled in.

    To do this, I wrote the logic in the following way:

    (1) get the LOV box-1 value and deriving the new values and set the session Variable to 1 and then refresh the Page. Now in PR get the Variable from Session 1 and assigning new values to LOV fields 2 and 3 and then using the property Setdisabled I deactivation.

    (2) getting the value of LOV field-4 and then drifting two new values and set the session Variable-2 and refresh the Page. Now in PR get Session-2, and then set the new values for the LOV-5 field and free text. But once the Page Refreshed and assigning values, values that we have given in the Point 1 in the LOV-2 fields, 3 turn white and field's get activated.

    Can you please let me how to achieve this? and also why the values are empty when I implement Point-2.

    Thank you
    Clarriiza

    Clarriiza,

    This VO have no matter what right SQL query, so even if you run the VO by using vo.executeQuery (), you will not get all the lines in the VO.

    So in the PR you need createRow and insert VO (otherwise your page no mistake) the below blog can be considered as an example.

    Reference: Oracle tips of Johny: OAF: how to create a PVO and use for Spel link in Oracle Application Framework

    On top of which is explained in the blog above, you set the values for the attributes of the useful, likely to set the value for the other LOV.

    I hope this helps.

    See you soon

    AJ

  • Calculate values based on the boxes are checked - for Dummies...

    Hello and thank you all in advance for your help. I'm trying to calculate a value based on the boxes checked. Specifically, I would like to add a particular value $$ each CheckBox and if this box is checked, I want to add to the total rental value (see screenshot below):

    Screenshot (1).png

    As you can see in the screenshot that I have different areas that can be selected (first floor, court before, etc.), I want to assign a value to the checkbox of each region (and added value for others) and calculate a total in the "Balance of rental fees" less the deposit. I'm new with java and scripts but not know how to do it in an excel formula. I guess it's very different from what little I know of Java. Any help you can give me would be greatly appreciated.

    Calculation options are in the text field. In this screen, you only need to set the value of exports to the amount this box represents.

  • To access the elements of an array of elements based on the value of the attribute

    Hi all

    I create a BPEL 11 g process that calls a web service which returns a data table. I need iterator on the data elements and access based on their attribute value.

    Here is a sample web service load:

    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <env:Header/>
       <env:Body>
          <OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/apps/inv/soaprovider/plsql/item_pub/get_item/">
             <GET_ITEM>
                <Row>
                   <Column name="ORGANIZATION_ID" sqltype="NUMBER">101</Column>
                   <Column name="ORGANIZATION_CODE" sqltype="VARCHAR2">MyOrg</Column>
                   <Column name="SEGMENT1" sqltype="VARCHAR2">MySegment</Column>
                   <Column name="DESCRIPTION" sqltype="VARCHAR2">Upload 445</Column>
                   <Column name="PRIMARY_UNIT_OF_MEASURE" sqltype="VARCHAR2">Each</Column>
                   <Column name="PRIMARY_UOM_CODE" sqltype="VARCHAR2">EA</Column>
                   <Column name="ITEM_CREATION_DATE" sqltype="VARCHAR2">01/21/2014 09:22:35</Column>
                   <Column name="ITEM_UPDATE_DATE" sqltype="VARCHAR2">01/21/2014 09:22:35</Column>
                   <Column name="REVISION" sqltype="VARCHAR2">0</Column>
                   <Column name="REVISION_LABEL" sqltype="VARCHAR2">0</Column>
                   <Column name="REV_CREATION_DATE" sqltype="VARCHAR2">01/21/2014 09:22:57</Column>
                   <Column name="REV_UPDATE_DATE" sqltype="VARCHAR2">01/21/2014 09:22:57</Column>
                </Row>
                <Row>
                   ...
                </Row>
                <Row>
                   ...
                </Row>
             </GET_ITEM>
          </OutputParameters>
       </env:Body>
    </env:Envelope>
    

    How can I get some columns based on the name of the column attribute?

    I tried to do this:

    bpws:getVariableData('getItemResponse','body','/ns7:OutputParameters/ns7:GET_ITEM/ns7:Row[$partIndex]/ns7:Column[@name='SEGMENT1'])
    

    and

    bpws:getVariableData('getItemResponse','body','/ns7:OutputParameters/ns7:GET_ITEM/ns7:Row[bpws:getVariableData('partIndex')]/ns7:Column[@name='SEGMENT1'])
    

    but I got this compilation error:

    Error (157): xpath expression "bpws:getVariableData ('getItemResponse', 'body','/ ns7:OutputParameters / ns7:GET_ITEM / ns7:Row [bpws:getVariableData('partIndex')] / ns7:Column [@name = 'SEGMENT1'])" appearing is not valid, because XPath query syntax error. The syntax error occurs when parsing bpws:getVariableData ('getItemResponse', 'body','/ ns7:OutputParameters / ns7:GET_ITEM / ns7:Row [bpws:getVariableData('partIndex')] / ns7:Column [@name = 'SEGMENT1']) expression XPath, posted on 112. The XPath query syntax was false; the exception was: anticipated :). Check the detailed origin described in the text of the exception message and verify that the XPath expression that is named in the error message is correct. The XPath expression is defined in the BPEL process.

    I use JDeveloper 11.1.1.7.0

    Thanks in advance,

    Bill

    Use an entitlement and copy node and you can get it to work by using the syntax below.

    Assign an expression of the copy below syntax: -.

     

           

    Query="/ns1:GET_ITEM/ns1:row[$index]/ns1:column[./@name='Segment1']"/ >

           

         

    Query = "" / client: processResponse / client: result "/ >"

  • Mandatory based on the value

    Dear all

    I need to adjust mandatory based on the comparison of two values in the value change listener back bean as below, only it wokes fine and I red flag saying that article is mandatory if the two values are not equal, if I changed the value to be equal, red flag still exist and still the element is required however I have something else to do the point is not required!

    public void RequiredRejectionReason (ValueChangeEvent vce) {}
    If (vce.getNewValue ()! = vce.getOldValue ()) {}
    If (! vce.getNewValue () .equals (MEDGO.) {AccessIteratorBinding("ClaimServicesVO1Iterator").getCurrentRow () .getAttribute ("AcceptedQnt")))}
    nonPayReason.setRequired (true);
    } else {}
    nonPayReason.setRequired (false);
    }
    }
    }

    Please notify.

    You assign the attribute partial trigger for your second field.
    can you also please try this code

    if (!vce.getNewValue().toString().equals(MEDGO.AccessIteratorBinding("ClaimServicesVO1Iterator").getCurrentRow().getAttribute("AcceptedQnt").toString())) 
    

    Instead

    if (!vce.getNewValue().equals(MEDGO.AccessIteratorBinding("ClaimServicesVO1Iterator").getCurrentRow().getAttribute("AcceptedQnt"))) 
    
  • Auto-fill text box values field based on the selection of the menu drop-down

    Try to fill in address, city, province, zip from text fields based on the selected option in a select form field. The following code works fine in Internet Explorer, but in Chrome or Firefox, after selection, text, the fields are filled with the word "undefined."

    I found a PHP script Jquery here version that would probabably do the trick.
    http://StackOverflow.com/questions/3657127/jQuery-populate-text-input-from-table-based-on-select-Valeur

    Maybe someone has a version of CF. they could share?

    Thanks in advance to anyone who can point me to a solution for this code, or a better way to fulfill my need.

    <!--> destinations with address auto-fill, city, etc.
    < script type = "text/javascript" >
    function selectAddress (list) {}
    take the first element is empty
    If (list.selectedIndex > 0) {}
    var locationID = list.options [list.selectedIndex] .value;
    locationAddress var = list.options [list.selectedIndex] .locationAddress;
    var locationCity = list.options [list.selectedIndex] .locationCity;
    var locationState = list.options [list.selectedIndex] .locationState;
    var locationZip = list.options [list.selectedIndex] .locationZip;
    document.getElementById('locationID').value = locationID;
    document.getElementById('locationAddress').value = locationAddress;
    document.getElementById('locationCity').value = locationCity;
    document.getElementById('locationState').value = locationState;
    document.getElementById('locationZip').value = locationZip;
    }
    }
    < /script >
    < b >
    < td align = 'right' bgcolor = "#FFFFFF" valign = "top" > Destination name < table >
    < td align = "left" bgcolor = "#FFFFFF" valign = "top" >
    < select name = "locationID" onChange = "selectAddress (this)" class = "smallforms" > "
    < option value = "" > SELECT the DESTINATION ››› < / option >
    < cfoutput query = "allLocations" >
    "" < option value = "" #locationName # "locationAddress =" #allLocations.locationAddress # "locationCity =" "#allLocations.locationCity #" locationState = "#allLocations.locationState #" locationZip = "#allLocations.locationZip #" > #locationName # < / option >
    < / cfoutput >
    < / select >

    Others: cfinput name = "destinationNameOther" type = "text" class = "smallforms" size = "75" >
    < br / >
    < input id = "locationID" name = "locationID" type = "hidden" > < br >

    Address: < input class = "smallforms" id = "locationAddress" name = "locationAddress" type = "text" size = "30" >
    City: < input class = "smallforms" id = "locationCity" name = "locationCity" type = "text" size = "20" >
    State: < input class = "smallforms" id = "locationState" name = "locationState" type = "text" size = "2" >
    Postal code: < input class = "smallforms" id = "locationZip" name = "locationZip" type = "text" size = "8" > < br / >
    < br / >
    < table > < /tr >

    In your last code done selectAddress refers to "index" but I'm not declared or assigned. I think that you are missing 'var index = list.selectedIndex;' statement.

  • Display values based on the flag

    Oracle 10g version

    Hi I have a model in a variable and I need display or hide some lables based on certain values.
    I have an example below .copying the output from the example below.
    I love lables I need to show or hide based on the values of the label. Please let me know the solution...
    /* Formatted on 2010/07/08 20:50 (Formatter Plus v4.8.8) */
    set serveroutput on;
    DECLARE
       v_content   VARCHAR2 (4000);
       v_mflag      VARCHAR2 (1)    := 'N';
       v_cflag      VARCHAR2 (1)    := 'Y';
       v_template   varchar2(4000)   := 
                                           'Date            :mail_dt
                                            Dear            :cust_name
                                            Request Number  :vzb_track_no
                                            Order Number    :ord_no
                                            Order Activity  :ord_activity
                                            Product         :prduct
                                            Managed         :managed
                                            Cpe             :cpe_ord';
    BEGIN
       v_content := replace(replace(replace(replace(replace(replace(replace(replace(v_template,
                ':mail_dt',sysdate),
                ':cust_name','Steven'),
                ':vzb_track_no','ABC123'),
                ':ord_no','XYZLKJHGVC'),
                ':ord_activity','Assigned'),
                ':prduct','Phone'),
                ':managed',v_mflag),
                ':cpe_ord',v_cflag);
                dbms_output.put_line(substr(v_content,1,254));
                dbms_output.put_line(substr(v_content,255,499));
    END;
    Out put
    Date                    08-JUL-10
    Dear                    Steven
    Request Number   ABC123
    Order Number      XYZLKJHGVC
    Order Activity      Assigned
    Product              Phone
    Managed            N    -- i dont need this row
    Cpe                   Y         

    new learner wrote:
    Out put

    Date                    08-JUL-10
    Dear                    Steven
    Request Number   ABC123
    Order Number      XYZLKJHGVC
    Order Activity      Assigned
    Product              Phone
    Managed            N    -- i dont need this row
    Cpe                   Y         
    

    You can strip the line before the declarations to REPLACE;

    DECLARE
       v_content   VARCHAR2 (4000);
       v_mflag      VARCHAR2 (1)    := 'N';
       v_cflag      VARCHAR2 (1)    := 'Y';
       v_template   varchar2(4000)   :=
    'Date            :mail_dt
    Dear            :cust_name
    Request Number  :vzb_track_no
    Order Number    :ord_no
    Order Activity  :ord_activity
    Product         :prduct
    Managed         :managed
    Cpe             :cpe_ord';
    BEGIN
       if v_mflag = 'N' then
         v_template := regexp_replace(v_template,chr(10)||'.*:managed');
       end if;
       v_content := replace(replace(replace(replace(replace(replace(replace(replace(v_template,
                ':mail_dt',sysdate),
                ':cust_name','Steven'),
                ':vzb_track_no','ABC123'),
                ':ord_no','XYZLKJHGVC'),
                ':ord_activity','Assigned'),
                ':prduct','Phone'),
                ':managed',v_mflag),
                ':cpe_ord',v_cflag);
       dbms_output.put_line(v_content);
    END;
    /
    
    Date            10-07-08
    Dear            Steven
    Request Number  ABC123
    Order Number    XYZLKJHGVC
    Order Activity  Assigned
    Product         Phone
    Cpe             Y
    
  • Negative value to run to analyze the report in the statspack report

    Hello

    I use Oracle 10.2.0.3.

    In the Execute to analyze the value of its pack stats report report, I get the negative value-35%. I read that this means that there are more number of parse as executions. But how and where it can be checked off, and what step I can take to resolve/correct this?

    I have a procedure 'a' who calls the procedure b, c and d in it.

    I have a table "t" that is referenced in the proceedings b, c and d (not in one)

    I've run a DDL on the table "t" where, by b, c and d invalid and in which cases invalidate the procedure as well.

    I call the procedure 'a' for execution, but in this procedure, I circumvent enforcement of procedures b, c and d (I can do this based on a condition and I don't call these procedures during execution of the procedure a).

    Then, when I call the procedure, it will be recompiled, but before he could be recompiled, oracle has recompile b, c and d as well.

    So in this case, I don't have that a single execution of procedure 'a' but compilation of a, b, c and d have run to analyze the ratio of 1:4.

    I hope you understand now. Which is why I suspect me that your procedures are be invalidated yet and still have several compilations.

    Salman

  • How can I design square wave which has a positive and negative values equal to the other and separated from each other by controlled time or distance

    How can I design square wave which has a positive and negative values equal to the other and separated from each other by controlled time or distance, as indicated in the figure below. and enter this signal in a data acquisition.

    At the time wherever you go for the beautiful diadram, you could have done the vi

    Your DAQ would like a waveform (table of values and dt ak 1/sampling rate)

    If you set the sampling rate you know the length of the array, create a matrix of zeros and set the values of the two amplitudes...

    Because I don't want to connect other duties here are some photos

    And it does have a few drawbacks leaves to be desired in my solution, just think... rounding errors and what might happen if the tables are becoming more...

  • VI to convert input signals NI 9402 in a RPM value, based on the frequency of the pulses

    Hello

    I'm looking for a VI convert an input signal NI 9402 in a RPM value, based on the frequency of the pulses. Is there such a thing that exists in the library of national instruments?

    I run LAbview 2014 integrated control and monitoring on on a cRIO 9802 high performance integrated system with NEITHER 9402, 4 channels, 50 LV, LV TTL Module input/output digital, ultra high speed digital i/o for the cRIO module.

    Any help would be greatly appreciated.

    The easiest way is to use the FPGA to get the time between the edges of your pulse increase (shift registers to maintain the current situation and the time will be necessary).  This will give you the period.  If it's a single pulse per turn, then the number of laps is just 60/T, where T is the time in seconds.

  • Change the text displayed, based on the threshold value

    Hi users of Labview,.

    I need help with display and editing text in labview.

    The text should display and change according to the following conditions:

    0 volt - "no power".

    1 volt - "controller ON".

    2 Volt - "Rotor Running"

    3 volt - "Rotor stopped".

    Based on the voltage read by the channel, the text must be displayed and modified on the same area of the front panel. For example, initially it will be 0 Volt and the text "No power" should appear as an indicator of text (and not as a warning message). He needs to change ' controller we ' when the chages of voltage from 0 to 1 volt. The canal reads the analog input voltage (range 0 - 5V).

    I'm relatively new to labview. So please give me pointers or from suggestions on how can be done. Any help is greatly appreciated.

    Thank you

    REDA

    Hello

    Thanks for the crossrulz of notes, have not used the front threshold.  For this simple example, it is "symmetrical", but I can see how the values in the table have been does not correspond to the index position that is so true useful.  Learn something every day, I could not resist, wanted to try.

    OK, here's a sample VI that puts a custom message based on the crossing of a threshold.  Home work is to study the components before asking to :-)

    The dice are the analog signal of 0 to 6.   He rounded to the whole number to provide the index number.  Power is the index number in the index table, the table being hard-coded text messages.

    Two additional indicators may be deleted, useful to see what is happening.

    And get rid of the value 0 if you want the text to match the number, he he he

    Enjoy.

  • How better to insert a subarray (line) in a 2D array to the correct index which is based on the value of the first column

    Hello

    I would like to insert a subarray (line) in a 2D to the correct index table. The position is to say the index value depends on the value of the first column of the table 2d.

    As an examlple my 2d array would look like this

    230 50 215 255

    300 60 270 330

    360 20 350 370

    And I would like to insert another line (subarray) with the following values

    320 40 300 340

    This new line should be placed between the second and third rows (this is based on the first column only).

    I tried the threshold 1 d function table by taking an 1Dsub array of my 2d array (first column), then using the first of the new line (320) as the threshold. It sort of work, but it does not work when I start the table (IE there is only 1 row) and it seems to not work properly on other occasions (as explained in the help of Labview).

    Hopefully the explanation is clear enough for any suggestion. Thanks in advance for the help!

    JTRI wrote:

    The idea is I have start with a new table and add these lines in the right order every time that the user sets the values Jack

    Ahh, so try this.

    This will also work with an empty array.

    You want to do with this function it is a Subvi.

    Make the entries 'table' and 'subarray"on the connector, then 'new array' output.

    You can then put this Subvi in a loop with a registry to shift and it will help to add new lines in a sorted order, when they are added.

    That is what you were aiming for?

  • remove the negative values in table

    I have a table 1 d of data depending on the positive and negative values. I'm trying to search for negative values and remove them from the table.  This corresponds to the data in the column in the second table 2D that should also be deleted. A minor problem is that there are an additional column in the 2D array that must be skipped.  I have the code that should do it.  The problem is that if I have two negative numbers in a row the code doesn't thow on the other.

    This first picture is the answer I get when alternate positive and negative values.  It shows the correct answer.

    When I change the first1 of the positive a-1 value as shown below...

    ... I get the following response.

    FYI, some other things such as conversion are here because I'm trying to manipulate the actual data set is enormous.  I test everything I do with the numbers that I can actually follow before I apply in my real program.  That's why I do extra things.

    Thanks for the help!

    Here is the solution, that increase the index when you do not remove an element. In addition, whether you use the "less then or equal" when you use the "lower to."

Maybe you are looking for

  • In the terminal, I can't type the (tiny) letter 'e '.

    2015 MBP, entirely updated OSX I opened a terminal window and if I type the letter 'e' (without the quotes of course) it beeps and tape not the letter.  All other letters works very well in the terminal.  Upper case E also works.  Just under E. In al

  • Dell XPS 8900 media card reader write protected: how to remove the protection?

    I use the card reader to write mp3 files on a micro-SD card to use in a small MP3. Until today, no problem. Now I get the error 'write protected' - and it is not because of the tab in the adapter SD being in the wrong position. There were a few quirk

  • Get a message from Zonealarm saying it has found a virus, is iehost.exe a virus?

    When you run Internet Explorer, I get a message from Zonealarm which tells me that it has found a virus. This virus is iehost.exe. What is and how to remove it if it is not a Windows program?

  • I received an email from Microsoft spam.

    Original title: why Microsoft makes it so difficult to account fraud poison Microsoft links   De : Microsoft Office Envoy: Wednesday, February 6, 2013 09:38 Topic: Update the Windows account Dear user, Due to a new vulnerability that is exploited by

  • Open a PDF email iphone

    I read on the site Web to choose 'open with Adobe acrobat reader. I have a regular mail on my iphone, how can I open the pdf file using the application?