Rounding to 50

Hello all,
i'd like to present some SQL for rounding number to whole 50. SQL code works from Oracle 9iR2 beyond.
Here's the code :
with input as
(select 1125.18 val
from dual)
select val,
case
when round (val) - round (val, -2) >= 25
then round (val, -2) + 50
when round (val) - round (val, -2) < 25
then round (val, -2)
end result
from input;
And result :
VAL RESULT
1125.18 1150

Surely this is easier?
with input as (select 1125.18 val from dual union all
               select 1030.9343 val from dual union all
               select 21.3 val from dual union all
               select 99 val from dual)
select round(val/50)*50
from input;
ROUND(VAL/50)*50
            1150
            1050
               0
             100

Similar Messages

  • How to round numbers in RTF templates?

    Hello!
    I'm using BI Publisher for Word (Oracle BI Publisher Builder for Word 10.1.3.4.1) to build a template to my BI Publisher report and I want to calculate this:
    avg(X)/(avg(Y)-avg(Z)/0.9)
    The result should be rounded to 3 places.
    I tried:
    <?(sum(X) div count(X)) div ((sum(Y) div count(Y)) - (sum(Z) div count(Z)) div 0.9)?>
    and I obtained the expected result.
    But, when I try to round in this way:
    <?xdofx:round((sum(X) div count(X)) div ((sum(Y) div count(Y))-(sum(Z) div count(Z)) div 0.9),3)?>
    I obtain 0 when is expected other value.
    Can someone help me?

    Hi ,
    You can select the number format in RTF template .Double click the Form Field select
    Type :Number
    Number Format :#,##0.000
    Thanks.

  • Query help with round up of dates

    Hi,
    I have a problem with my query.
    I am calculating the difference between two dates and I want to get the hours.
    The problem is that I want the following to happen:
    if the difference is x such that x > 0 it should round it up to 1 (example: x = 0.1 it should be rounded up to 1)
    if the difference is y such that y >1 it should be rounded to 1 (example y = 1.05 it should be rounded up to 2)
    i have the following query at the momet:
    select to_char(arrivaldate,'DD/MM/YYYY hh24:mi:ss') as "ARRIVAL", to_char(departuredate,'DD/MM/YYYY hh24:mi:ss') as "DEPARTURE", round(trunc(mod((departuredate-arrivaldate)*24,24),2)) as duration from stay_log;
    thanks.

    Hi,
    Format your code so that the physical appearance of the code gives some hint as to what you're doing, as I did below.
    When posting code on this forum, always type &#123;code&#125; tags at the beginning and end of formatted sections.
    Do you mean that, instead of 21, you want to use the flightid from the main query?
    If so, that's called a "correllated query". The tables in the main query (and their columns) can be reference in the sub-query, like this:
    select     flightid                         as "FLIGHT",
              select     destairport_id
              from     journey,
                   flight
              where     flight.flightid  = stay_log.flight_id   -- correlated to main query
              and     flight.journeyid = journey.journeyid
         )                              AS "AIRPORT",
         to_char(arrivaldate,'DD/MM/YYYY hh24:mi:ss')     as "ARRIVAL",
         to_char(departuredate,'DD/MM/YYYY hh24:mi:ss')     as "DEPARTURE",
         ceil((departuredate-arrivaldate)*24)          as "DURATION",
         cost                              as "COST"
    from     stay_log;Often, people give a table alias to the main query table that is being referenced in the sub-query, as shown below.
    That's only required when the table name appears in both FROM-clauses.
    select     flightid                         as "FLIGHT",
              select     destairport_id
              from     journey,
                   flight
              where     flight.flightid  = s.flight_id     -- table alias s used here
              and     flight.journeyid = journey.journeyid
         )                              AS "AIRPORT",
         to_char(arrivaldate,'DD/MM/YYYY hh24:mi:ss')     as "ARRIVAL",
         to_char(departuredate,'DD/MM/YYYY hh24:mi:ss')     as "DEPARTURE",
         ceil((departuredate-arrivaldate)*24)          as "DURATION",
         cost                              as "COST"
    from     stay_log   s     -- table alias s defined here
    ;

  • Unable to read data from an excel document of 365*24 values ( all rounded to 4 decimal points)

    I have an excel sheet containing data of hourly loads in MW( rounded to 4 decimals) of one year.  So, I have 365*24 values that I want to import to Labview using Read from spreadsheet.vi. However what i get in the output array is 0's and randomly some unit values at very few places. I have checked the array size of the output array and it shows different array sizes for different yearly data.
    I am attaching the four excel spreadsheets .
    Plz help me with the issue I am facing.
    Attachments:
    Load-2012.xlsx ‏95 KB
    Load-2013.xlsx ‏94 KB
    Load-2014.xlsx ‏59 KB

    If you are using LabVIEW 2014, it includes the Report Generation Toolkit (which is also available as an add-on in earlier LabVIEW Versions).  This can read native Excel files, including .xlsx.  With a few functions (3 or 4, I think), you should be able to get the entire Table into a 2D array.
    Bob Schor

  • Issue with ROUND function in RTF template

    Hi All,
    Can anyone please help me in implementing the ROUND function at the RTF template.
    Need to handle rounding of amounts at the RTF template level itself.
    The ROUND function should be implemented to the following tags:
    <?sum(current-group()/TAXABLE_AMOUNT)?> (Record level)
    <?sum(TAXABLE_AMOUNT)?> (Report level total)
    Eg. If the Sum(current-group()/TAXABLE_AMOUNT) for a particular record is 401.65 then it should round of to 402
    we try to do this using following syntax ..
    1) by declaring variable "value"
    <?xdoxslt:set_variable($_XDOCTX, value, sum(current-group()/TAXABLE_AMOUNT))?>
    2) <?xdofx:round(sum(current-group()/TAXABLE_AMOUNT))?>
    3)<?xdofx:round(xdoxslt:sum(current-group()/TAXABLE_AMOUNT))?>
    but we ding get the solution.
    A quick response on this is highly appreciable.
    Thanks,
    Praveen

    Re: Summing derived values within xdofx:
    Re: Rounding not working

  • Round Edged boxes in rtf templates

    Hi all,
    I have been really struggling to design rtf templates for XML Publisher with round edged boxes.
    The client requirement is to have all the tables/objects that contain data to have rounded edges..Just like a flowchart box..
    I have tried using the flowchart box, but when I increase the height/width of the object, the radius of the actual round edge object increases, thus distorting the entire look of the template.
    Can anyone give me some pointers on how I can overcome this issue using rtf templates.
    I would have gladly done this as a PDF template, but for the issue with lack of support for conditional logic.
    Any help will be truly appreciated
    Thanks,
    Lavina

    Hi ,
    You can select the number format in RTF template .Double click the Form Field select
    Type :Number
    Number Format :#,##0.000
    Thanks.

  • How to round values in CU41

    I would like to round characteristic value in dependency code.
    Thanks

    Hi,
    If this is your Original SQL statement, then it won't work.
    You have to change the line in AFTER_PARAMETER_FORM trigger from
    :lp_customer :=' AND account_number in ("44010","44020","44030")'to
         :lp_customer := ' account_number in (''44010'',''44020'',''44030'')';Then it will work.
    Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • How to round numbers to the nearest .25

    I would like to enter a number in one field and have it rounded to the nearest .25 in another column - (whether that's rounding up or down)
    Example:
    Actual Size
    Adjusted Size
    7.21435
    7.25
    Any help would be appreciated.
    Thanks!

    Hi c,
    The ROUND function limits the precision choices to powers of 10, so we need to work within that limitation:
    Multiply by four, round to the nearer whole number, divide by four.
    Formula in column B: =ROUND(A*4,0)/4
    All cells in B are formatted as Number, with decimal places set to 2.
    Regards,
    Barry

  • How to round numbers

    assume variable a is 4.647 and i want to convert this to 4.5 . how can i round numbers like this. Is there is a predefined method in java to achive this.

    I don't think java.lang.Math.round() will do what the original post asked for, since it rounds to the nearest long number. So you still would have to write your own method to round 4.647 down to 4.5.

  • How to round numbers using javascript in Adobe Acrobat Pro?

    How to round numbers using java script in Adobe Acrobat Pro?
    For example:
    1.2 becomes 1.0
    1.7 becomes 2.0
    Thank you.

    Assuming you've already set the field to a Number format category and limited it to one digit to the right of the decimal, you can use the following custom Validate script:
    // Custom Validate script
    event.value = Math.round(event.value);
    More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/roun d

  • How to round numbers in java?

    hey everyone. just wondering how i can round my final answer which is "repayment" located on the last line to the nearest whole value. thanks :) this is my code:
    //Conversion and Calculation
    principle = reader.readDouble("Enter Loan Amount: ");
    interestRate = reader.readDouble("Enter YEARLY interest rate: ");
    convertedRate = interestRate / 100;
    monthlyRate = convertedRate / 12;
    timePeriod = reader.readDouble("Enter the number of years for the repayment: ");
    convertedPeriod = timePeriod * 12;
    //Calculation Monthly Repayment Amount for a fixed number of years
    topHalf = Math.pow((1+monthlyRate),convertedPeriod);
    bottomHalf = (Math.pow((1+monthlyRate),convertedPeriod)-1);
    fraction = topHalf / bottomHalf;
    repayment = principle * monthlyRate * fraction;
    writer.println ("Fixed Monthly Repayment Amount = $" +repayment);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Good point: Klue2k, don't forget about the negative
    case.Yes, never forget about the negative case. Your
    solution doesn't work with negative numbers!
    And by the way, if you had a little bit more of the
    good old klue2k, you wouldn't be embarassing yourself
    in this way.I think you're confusing me with somebody who give a 5h!t.

  • ROUND AND DYNAMIC SQL

    Greetings,
    i will be grateful if you help me on this :
    i have this portion of code in the body of a procedure,but i can't register it because of the error : PL/SQL ORA-00907 parenthése de droite absente
    select ROUND((execute immediate(v_formule)),2)
    INTO v_valeur
    FROM risque_taux_interet
    WHERE id_instrument = (select id_instrument from risque_taux_interet WHERE duration_modifiee = p_duration_modifiee);
    dbms_output.put_line(v_valeur);
    Regards
    AC

    untested..
    DECLARE
       v_formule    VARCHAR2 (4000);
       v_formule1   VARCHAR2 (1000);
       v_valeur          NUMBER;
    BEGIN
       EXECUTE IMMEDIATE v_formule
                    INTO v_formule1;
    /*select ROUND((execute immediate(v_formule)),2)
    INTO v_valeur
    FROM risque_taux_interet
    WHERE id_instrument = (select id_instrument from risque_taux_interet WHERE duration_modifiee = p_duration_modifiee);
    dbms_output.put_line(v_valeur);
       SELECT ROUND (v_formule1, 2)
         INTO v_valeur
         FROM risque_taux_interet
        WHERE duration_modifiee = p_duration_modifiee;
       DBMS_OUTPUT.put_line (v_valeur);
    END;
    Regards,
    friend

  • Cursor not working properly with 300px soft round

    Whenever I select the 300px soft round option for any tool with a brush option--brush, eraser, smudge, dodge/burn, etc--my cursor (which is set on "normal brush tip") gets all messed up. It reverts back to the regular pointer, it jumps around on the screen when I try to move it, and the "click" action happens a little bit to the right of where the cursor is, if that makes sense (I can't think of a better way to describe it). If I change the size of the brush (starting off from any brush) to 300px I'll get the same result, and this also happens if I change the size to anything from arount 150px to 350px. Sometimes it'll randomly change to the eyedropper tool as well. It is extremely irritating. I tried to take a screen recording so I could better show what I'm describing but when I played it back everything looked like it was working normally! I thought I was going crazy until I asked someone else to take a look and verify that there actually was a problem.
    I've installed the update, restarted Photoshop, and restarted my computer with no luck. I'm using Photoshop CS5 on a MacBook Pro, OS 10.7.2. I was using my tablet (a Wacom Bamboo) when I first noticed the problem but whether I'm using my tablet or my trackpad doesn't seem to make a difference; the problem still remains. Please help

    Look at the other topics about the bugs in MacOS 10.7 with the Intel HD3000 GPU.
    Apple is working on it.

  • Issue in MODVAT Clearing Account and Rounding off of Excise.

    I have one issue in MODVAT Clearing Account and Rounding off of Excise.
    Example:
    Material cost    100Rs.
    Excise  value
    1. BED             10.5 Rs
    2. ECes             2.1 Rs
    3. HEces          1.3.Rs
    At the time of GR
    Material Ac Dr          100 
         To GR/IR                        100
    At the time of Excise Capture
    We done the rounding of Excise value
    RG23 A  BED         11
    RG23 A  Eces          2
    RG23 A  HEces        1
       To MODVAT            14
    At the time of IR . System create IR with reference of PO
    GR/IR  DR      100
    MODVAT         13.9
        To Vendor         113.9
    So here you can see that there is a difference of 0.1 in MODVAT account and hence we are crediting Vendor  with the lesser amount here with 0.1 RS.
    So we cannot reconcile the MODVAT Account
    Less Payment to vendor by 0.1 Rs
    So is there any solutions on that.
    regards
    Shayam
    Edited by: Shayam_210 on Jan 3, 2011 7:08 AM
    Edited by: Shayam_210 on Jan 3, 2011 7:09 AM

    Hi,
    Check the rounding setting in below:-
    SPRO > Logistics - General > Tax on Goods Movements > India > Basic Settings > Maintain Company Code Settings
    SPRO > General Settings > Currencies > Define rounding rules for currencies
    Regards,
    Gaurav

  • I've just downloaded itunes on a new computer, and I'm downloading music from the cloud, but it seems to stick on certain songs and won't download them at all, stopping at a certain point. How do I get round this?

    Hi all,
    I've just downloaded itunes onto a new computer, and I'm currently downloading previously owned music from the cloud. However, it keeps sticking on various songs - it will get part of the way through and just stop, this seems to happen to about 1 in 10 songs. How do I get round this?
    Also, once I've finished dowloading from the cloud, how do I get my library to display only the songs I've downloaded, and not all the other ones that I don't want anymore?
    Cheers, Alex

    On the new laptop, launch iTunes. From the menu bar click Store / Authorize This Computer.
    iTunes Store: Transferring purchases from your iPhone, iPad, or iPod to a computer

  • I'm trying to sign in to icloud on my laptop to access my itunes but it says my apple id is valid but wont open.  I don't have an apple phone, I have an android phone.  How can i get round this?

    I am trying to access some of my songs on itunes on my pc but it's says I need to install icloud.  I did this but it says I need to sync my phone but that is an android phone.  It says my apple id is valid but still won't let me sign in.  How can I get round this?

    Enchanted1 wrote:
    All this and I still don't have enough space on my startup disk, but that's another whole question!
    No, this should be the number one thing you are concerned about.
    Until you get this sorted, there is a good chance you may simply lose everything.
    Do you hav ean external drive?
    If so copy the entire /Music/iTunes/ folder to the external drive.
    Then you can delete /Music/iTunes/ empty the trash and recover this space.
    Do this then Apple menu > Software update.
    Restart the computer
    Then post back.

Maybe you are looking for

  • Error while submitting a BUTTON defined on Page 0

    Hi, I am creating a Feedback/Rating region (user will select from rating 1, 2, ... 4, 5 ) and the response will be stored in database table. - I have created the Region at Page 0 (my requirement is to display this at all the Pages). This region consi

  • Oracle error codes

    Hello, My application is handling exceptions like this: try{ resultSet = pStatement.executeQuery(); catch(SQLException e){ conn.close(); if(e.getErrorCode() == 942) // handle with table or view doesn't exist else // handle with other errors Is there

  • Improvements to mac OS updates interface

    Does anyone else find the interface for Mac OS updates annoying?  Here are the problems I have. 1. When an update is available I get a notification that I must do something about - even when I do not want to pay attention to updates. 2. The notificat

  • TS3367 For a while now Facetime no longer works on my iphone4...

    Does anyone know what the issue is or how to fix it? An ipad and my girlfriend's iphone5 works fine, even on the same network, so it's an issue with the phone. I just updated to ios7, but that hasn't made a difference.

  • Image Resizing Problem

    Hello, I am working on image project. The task which I want to do is to resize the image. I am using normal java.awt.image package. The classes which I am using are AffineTransformOp for scaling an image, Graphics and BufferedImage etc. The problem i