Daniele
Daniele

Reputation: 480

How do I convince Oracle SQL Developer to show number in scientific notation?

I'm using Oracle SQL Developer version 4.0.3, and I have a number in the order of 1e-13, so it's kind of inconvenient to have it shown as 0.0000000000001...

I couldn't find any option to change this behaviour, what I'd like is something like the opposite of this question, but for Oracle SQL developer: How to set numwidth in the grid output of PL/SQL developer?

I just cannot find anything similar, does anyone know if this is possible?

Upvotes: 1

Views: 6043

Answers (2)

Alex Poole
Alex Poole

Reputation: 191265

From the documentation:

to_char(<your number column>, '9.9EEEE')

In SQL Developer 4:

SQL Developer window

I can't see any way to apply a model globally, as suggested by the accepted answer from the question you linked to - the current version of SQL Developer doesn't seem to have 'SQL Window' section under preferences like PL/SQL Developer does. But you probably don't want to apply the model to every number in every result set anyway.

Upvotes: 1

Lalit Kumar B
Lalit Kumar B

Reputation: 49062

Use TO_CHAR(1e-13, '0.9999999999999');. You need to check for the proper format model to convert the scientific notation into string. I used '.', you could also use 'D' as decimal separator, but it depends on your NLS_NUMERIC_CHARACTER.

See the different number formats here, http://www.java2s.com/Tutorial/Oracle/0300__Conversion-Functions/FormatParameters.htm

Update I initially answered the opposite of the requirement, i.e. convert from scientific notation to regular number format. The update is about converting number into scientific notation.

In SQL Developer, you would see something like this :

enter image description here

In SQL*Plus, the same SQL would convert the number into its scientific notation`.

SQL> WITH DATA AS(
  2  SELECT to_number('0.0000000000001','0.99999999999999') num FROM dual
  3  )
  4  SELECT to_char(num, '9.9EEEE') num
  5  FROM DATA;

NUM
---------
  1.0E-13

SQL>

Without a format,

SQL> WITH DATA AS(
  2  SELECT to_number('0.0000000000001','0.99999999999999') num FROM dual
  3  )
  4  select num from data;

       NUM
----------
1.0000E-13

SQL>

Upvotes: 0

Related Questions