Home » SQL & PL/SQL » SQL & PL/SQL » Different Values of RAWTOHEX in Oracle 12c and 11g (Oracle 12.1.0.2.0 and Oracle 11.2.0.1.0 Both Enterprise Editions)
Different Values of RAWTOHEX in Oracle 12c and 11g [message #676756] Fri, 12 July 2019 07:48 Go to next message
Manoj.Gupta.91
Messages: 239
Registered: March 2008
Location: Delhi
Senior Member
Hi All,

I'm facing an issue with RAWTOHEX value function where it is generating different values for the same input on two different database versions i.e. Oracle 11.2.0.1.0 Enterprise Edition and Oracle 12.1.0.2.0 Enterprise Edition.


[b]Oracle 12.1.0.2.0[/b]

select rawtohex( 'š‡ÏAï®À') FROM DUAL ;

C5A1E280A1C38F41C3AFC2AEC38012

[b]Oracle 11.2.0.1.0[/b]

select rawtohex( 'š‡ÏAï®À') FROM DUAL ;

9A87CF41EFAEC012

Please help me to understand why the output values are different in two different oracle versions. Ideally same value should have been returned.


Thanks & Regards
Manoj
Re: Different Values of RAWTOHEX in Oracle 12c and 11g [message #676759 is a reply to message #676756] Fri, 12 July 2019 08:08 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
from both version please post results from SQL below

select DUMP('š‡ÏAï®À') FROM DUAL ;
Re: Different Values of RAWTOHEX in Oracle 12c and 11g [message #676760 is a reply to message #676756] Fri, 12 July 2019 09:06 Go to previous messageGo to next message
Solomon Yakobson
Messages: 3273
Registered: January 2010
Location: Connecticut, USA
Senior Member
And what are the character sets for each of the databases?

SY.
Re: Different Values of RAWTOHEX in Oracle 12c and 11g [message #676762 is a reply to message #676756] Fri, 12 July 2019 10:31 Go to previous message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

In addition to Solomon answer, here's an abstract of the documentation:

Quote:
RAWTOHEX converts raw to a character value containing its hexadecimal representation

It is obvious that 'š‡ÏAï®À' is NOT a RAW data but a CHAR one.

So you have first an implicit conversion from CHAR to RAW before the function applies and so the dependence on the database character set hence Solomon's question.

[Updated on: Fri, 12 July 2019 10:37]

Report message to a moderator

Previous Topic: MAX(DECODE
Next Topic: Returning into clause for insert selectstatements
Goto Forum:
  


Current Time: Fri Apr 19 07:34:02 CDT 2024