Number Datatype in Oracle Database

In this Oracle tutorial, we will learn about the number datatype in oracle database. Also, we will cover these topics apart from the oracle numeric data type.

  • Number Datatype in Oracle db
  • Number Datatype in Oracle Size
  • Number Datatype in Oracle Max Length
  • Number Datatype in Oracle PL SQL
  • Number Datatype in Oracle Equivalent in SQL Server
  • Number Datatype in oracle Precision Scale
  • Number Datatype in oracle 12c, 11g, 19c

Number Datatype in Oracle Size

In this section, we will learn about the size of Number data type in oracle database.

  • Number is having precision p and scale s. The precision p can range from 1 to 38. The scale s can range from -84 to 127. Both precision and scale are in decimal digits. A NUMBER value requires from 1 to 22 bytes.
  • Suppose the number is 724.89 now p will be 5 which is the total count of numbers and s will be 2 which is the total numbers after decimal.
precision in oracle database
precision (p) = 5 and scale (s) = 2
  • The above statement will be displayed Number(5, 2) this way while creating oracle database.
  • Here is the syntax of number data type in oracle database.
NUMBER[(p [, s])]

Read How to create a database in Oracle 19c

Number Datatype in Oracle Max Length

In this section, we will learn about number data type max length in oracle database.

The precision p can range from 1 to 38. The scale s can range from -84 to 127. Both precision and scale are in decimal digits. A NUMBER value requires from 1 to 22 bytes.

Number Datatype in Oracle Pl SQL

In this section, we will lean about number datatype in oracle plsql.

  • The Number data-type is the most common numeric datatype in oracle and PL/SQL programming.
  • It is use to store integer and float values of any size.
  • Number is implemented in a platform independent manner.
  • In PL/SQL we can assign the data type using declare.
DECLARE
   emp_salary NUMBER;

Read Connect to Oracle Database using Python

Number Datatype in Oracle Equivalent in SQL Server

In this section, we will learn about number datatype in oracle equivalent in sql server.

  • In SQL server, Oracle NUMBER data type is equivalent to DECIMAL, NUMERIC, MONEY and SMALL MONEY data type.
  • You can provide the precision and scale values in these data types to get the results with decimal value.
DECIMAL(5, 2)     # Decimal Data type

NUMERIC(5, 2)     # Numeric Data type

MONEY(5, 2)       # Money Data Type

SMALL MONEY(5, 2) # Small Money Data type

Read How to Fetch Data from Oracle Database in Python

Number Datatype in oracle Precision Scale

In this section, we will learn about number data type in oracle precision scale.

  • The Oracle NUMBER data type has precision and scale.
  • The precision is the number of digits in a number. It ranges from 1 to 38.
  • The scale is the number of digits to the right of the decimal point in a number. It ranges from -84 to 127.
  • Example: 724.89 In this number precision is the total count of number which is 5 and scale is the count of numbers after decimal towards right side which is 2.
  • We have demonstrated this example using a diagram.
precision in oracle database
precision (p) = 5 and scale (s) = 2

Read Connect Excel to Oracle Database

Number Datatype in oracle 11g, 12c, 19c

In this section, we will learn number data type in oracle 11g, oracle 12c and oracle 19c. We will strike the difference if any.

Number datatype in oracle 11gPrecision can range from 1 to 38.
Scale can range from -84 to 127.
Number datatype in oracle 12cPrecision can range from 1 to 38.
Scale can range from -84 to 127.
Number datatype in oracle 19cPrecision can range from 1 to 38.
Scale can range from -84 to 127.
Number data type in oracle 11g, 12c & 19c

There are no changes in the precision and scale ranges for different version of oracle database.

You may like the following oracle tutorials:

In this tutorial, we will learn about the number datatype in oracle database. Also, we will cover these topics.

  • Number Datatype in Oracle db
  • Number Datatype in Oracle Size
  • Number Datatype in Oracle Max Length
  • Number Datatype in Oracle PL SQL
  • Number Datatype in Oracle Equivalent in SQL Server
  • Number Datatype in oracle Precision Scale
  • Number Datatype in oracle 12c, 11g, 19c