Home > Database > Oracle > body text

How to convert hexadecimal to decimal in Oracle

WBOY
Release: 2022-06-13 10:46:48
Original
4996 people have browsed it

In Oracle, you can use the "to_number()" function to convert hexadecimal to decimal data. This function is used to convert strings into numerical formats, and the parameters within the function need to be used Enclosed in single brackets, the syntax is "select to_number('hexadecimal number','xx') from dual".

How to convert hexadecimal to decimal in Oracle

The operating environment of this tutorial: Windows 10 system, Oracle version 12c, Dell G3 computer.

How to convert hexadecimal to decimal in oracle

TO_NUMBER function () is one of the commonly used type conversion functions in Oracle. It mainly converts strings into numerical formats. It is exactly the opposite of the TO_CHAR() function.

The format of the To_number function is as follows:

To_number(varchar2 or char,’format model’)
Copy after login

Convert hexadecimal to decimal,

use to_number, the parameters inside are hexadecimal data, and the parameters are in single Examples of

SQL> select to_number('ff','xx') from dual;
TO_NUMBER('FF','XX')
--------------------
255
Copy after login

enclosed in quotation marks are as follows:

How to convert hexadecimal to decimal in Oracle

##Expand knowledge:

--10 in To convert system to hexadecimal, use to_char, the parameters inside are decimal data, and the parameters do not need to be enclosed in single quotes

SQL> select to_char(255,'xx') from dual;
TO_CHAR(255,'XX')
-----------------
ff
Copy after login
Recommended tutorial: "

Oracle Video Tutorial"

The above is the detailed content of How to convert hexadecimal to decimal in Oracle. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template