Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Converting Negative Numbers to Hex

359473Feb 17 2004 — edited May 21 2006
Hello,

I have a number filed which holds the representation of RGB colors in decimal number.
I would like to get the Hex string representation and split the Alpha, Red, Green, Blue values in my query to pass to my application.

I have used the to_char (number, ‘xxxxxxxx’) and to_char (number, ‘fm0xxxxxxxx’) and with negative numbers both returns ‘#’ signs!

Here is an example:

The value in the color filed is ‘-16776961’. Converting this number to Hex using 4 bytes representation gives me ‘FF0000FF’. Bytes from left to right represent Alpha, Red, Green, and Blue values. In this case the RGB value represents color Blue (FF) and the Alpha value is ‘FF’ also.

Is there anyway I can get the hex representation of negative numbers.

Thanks in advance.

AR
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 18 2006
Added on Feb 17 2004
3 comments
1,862 views