In Oracle Database, there is a wide range of datatypes available to store different types of data. One such datatype is binary_double.
In this article, we will discuss the binary_double datatype in Oracle 21c and how it can be used to store and manipulate double-precision floating-point numbers.
Introduction to Oracle binary_double Datatype
Oracle Database uses the datatype binary double to hold double-precision floating-point integers. A 64-bit number that can represent numbers with more precision and range than a single-precision floating-point number is called a double-precision floating-point number.
The binary_double datatype is used to store these numbers in the database.
Also, check: Oracle rowid Datatype
Advantages of binary_double datatype
The ability to accurately and precisely store and manipulate double-precision floating-point integers is one of the key benefits of utilizing the binary double datatype. This is especially helpful in scientific and engineering applications where computations with great accuracy are necessary.
The fact that the binary double datatype is a built-in datatype in the Oracle Database, which means it is performance-optimized and can be used in both SQL statements and PL/SQL scripts, is another benefit of utilizing it.
Oracle binary_double datatype Syntax
The syntax for declaring a column of binary_double data type in Oracle 21c is as follows:
Here, “column_name” is the name of the column you want to create. You can include this syntax in a CREATE TABLE statement to create a table with a column of binary_double datatype.
Read: Oracle Varchar2 Datatype
Oracle binary_double datatype Example
Here’s an example of how you can create a table with a binary_double column in Oracle 21c.
CREATE TABLE employees ( emp_id NUMBER, emp_salary BINARY_DOUBLE );
In this example, we have created a table called “employees” with two columns: “emp_id” and “emp_salary”. The “emp_salary” column is of type binary_double.
To insert a double-precision floating-point number into the binary_double column, you can use an INSERT statement. Here is an example of how to insert a double-precision floating-point number into the “emp_salary” column.
INSERT INTO employees (emp_id , emp_salary) VALUES (1722, 12.141); select * from employees;
Now we will use the binary_double datatype in a SQL developer tool using oracle 21c.
Now we will insert the values into the following given table
INSERT INTO customers (cust_id , cust_salary) VALUES (534, 15.132); select * from customers;
Also, check: Oracle smallint Datatype
Features of oracle binary_double datatype
- Precision: The Binary Double data type may store very large or very small integers because it is a 64-bit floating-point number with a precision of 15 to 17 decimal digits.
- Arithmetic Operations: The Binary Double data type supports trigonometric functions like sine, cosine, and tangent as well as arithmetic operations like addition, subtraction, multiplication, and division.
- Storage Space: Compared to other floating-point data types like Float and Double Precision, the Binary Double data type uses substantially less storage space—only 8 bytes—than those other data types.
- The Binary Double data type is completely consistent with the IEEE 754 standard, making it interoperable with other platforms and programming languages that adhere to the same standard.
So, in this Oracle tutorial, we understood how to define and use the Binary_double Datatype in Oracle Database. And we have also covered a few sample examples related to it.
Also, take a look at some more Oracle tutorials.
I am Bijay having more than 15 years of experience in the Software Industry. During this time, I have worked on MariaDB and used it in a lot of projects. Most of our readers are from the United States, Canada, United Kingdom, Australia, New Zealand, etc.
Want to learn MariaDB? Check out all the articles and tutorials that I wrote on MariaDB. Also, I am a Microsoft MVP.