How to compare hexadecimal values in oracle sql?

Member

by lily , in category: MySQL , 10 months ago

How to compare hexadecimal values in oracle sql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by jasen_gottlieb , 10 months ago

@lily 

In Oracle SQL, you can compare hexadecimal values by converting them to decimal values using the TO_NUMBER function and then using standard comparison operators.


Here is an example:

1
2
3
SELECT *
FROM your_table
WHERE TO_NUMBER(hex_column, 'XXXXXXXX') > TO_NUMBER('ABC', 'XXXXXXXX');


In this example, hex_column is the column containing hexadecimal values, and we are comparing it with the hexadecimal value 'ABC'.


Make sure to replace your_table and hex_column with your actual table and column names. You can also change the comparison operator as needed (e.g., =, <, <=, etc.).

Related Threads:

How to compare date values (xsd:date) with years in sparql?
How to import oracle sql file into mysql?
How to compare the data from same table in oracle?
How to compare date to format date on oracle?
How to compare different format date in oracle?
How to get 2 distinct rows from 1 row with 3 tables in sql oracle?