Citali wrote: ============ raw_value := utl_raw.cast_from_number('2'); -- This is equal to c103 -- and then I try to get the complement or negative value with this: select utl_raw.bit_COMPLEMENT('c103') from dual; UTL_RAW.BIT_COMPLEMENT('C103') --------------------------------- 3efc SELECT utl_raw.cast_to_number('3efc') FROM dual UTL_RAW.CAST_TO_NUMBER('3EFC') --------------------------------- -105 What I'm expecting is: 13 ... ===== Citali cast_to_raw takes an Oracle number and shows you its hex representation. That's not the same as converting a binary number into hex. Use the CAST_FROM_BINARY_INTEGER (if you supply a 'normal' number or literal, there will be an implicit conversion of the parameter): SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 18 16:30:02 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> connect testuser/testuser Connected. SQL> select utl_raw.cast_from_binary_integer(256) from dual 2 / UTL_RAW.CAST_FROM_BINARY_INTEGER(256) -------------------------------------------------------------------------------- 00000100 SQL> Now you should be able to do your logic using other UTL_RAW functions.... Keep an eye on the length of the RAWs.... Regards Nigel