About 587,000 results
Open links in new tab
  1. 3 Ways to Format a Number to 2 Decimal Places in Oracle - Database.Guide

    Sep 10, 2021 · When using Oracle Database, you can use functions like TO_CHAR(number) to return numbers as a string, formatted to two decimal places (or however many decimal places you require). Or you can use functions like ROUND(number) and TRUNC(number) to round or truncate the number to your required number of decimal places.

  2. Oracle SQL - How to display 2 decimal places - Stack Overflow

    May 5, 2021 · In SQL*Plus (or similar, even GUI tools), formatting is done by the TO_CHAR function and desired format mask. If you want two decimals and (just for example) thousands separator, you might do something like this: 2 (select 230000 from dual union all. 3 select 3.14 from dual union all. 4 select 0.0002 from dual union all.

  3. Rounding to 2 decimal places in SQL - Stack Overflow

    Nov 1, 2013 · This works too. The below statement rounds to two decimal places. SELECT ROUND(92.258,2) from dual;

  4. How to always show two decimal places on a number in PL/SQL

    Jul 30, 2015 · v_string := v_string || '183' || lpad(1, 3, '0') || '0'; However I cannot get the final string to properly have two decimals in all use cases. For example if the value in the db is 125 I get this for a final string. however it should have been.

  5. How to Format Numbers in Oracle - Database.Guide

    Oct 7, 2021 · You can use functions like TO_CHAR(number) and even LPAD() to convert numbers to a string and format them exactly as you like on the fly. Functions like CAST() can also have an effect on how a number is formatted, depending on the data type that it’s being cast as.

  6. oracle - How to display a number with fixed number of digits …

    It looks like you are trying to convert a number to a number - try to_char instead: select to_char(123.56,'0999.99') from dual; TO_CHAR(123.56,'0999.99') ------------------------- 0123.56

  7. Format number to two decimal places - Oracle Forums

    Jun 22, 2010 · I want to convert a number (with two decimal places) to a string but keep the trailing zeros. The number can be of any length. Using a format mask in with the to_char function doesn’t work for me because the results are written to a text file using UTL_FILE and I don’t want any leading white spaces. As you can see the to_char only works partially.

  8. Convert a number to have 2 decimal places in Oracle - Experts Exchange

    Jan 21, 2019 · The TO_CHAR will do what you want, which is convert the number to a string and give it a format.

  9. ROUND (number) - Oracle Help Center

    ROUND returns n rounded to integer places to the right of the decimal point. If you omit integer, then n is rounded to zero places. If integer is negative, then n is rounded off to the left of the decimal point. n can be any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type.

  10. Force conversion of a number value in pl sql to two decimal places ...

    Nov 26, 2016 · Need help regarding force conversion of a number value in pl sql to two decimal places. Ex: 120.55 will remain as 120.55. 120.5 will be converted to 120.50. 120 will be converted to 120.00. The variable which stores the value is defined with datatype as Number (8,2).

Refresh