ORA-06502 with UTL_RAW [message #657123] |
Fri, 28 October 2016 07:12 |
|
qazims92
Messages: 37 Registered: July 2016 Location: Lahore Pakistan
|
Member |
|
|
Hi Experts,
When we execute following command on 11.2.0.1, we get result.
But when we execute same command on 11.2.0.4.0 then we get ORA-06502.
select UTL_RAW.cast_to_number(rawtohex(to_char(trim('JSC010')))) from dual;
Kindly guide.
Regards,
Qazi
|
|
|
Re: ORA-06502 with UTL_RAW [message #657127 is a reply to message #657123] |
Fri, 28 October 2016 07:23 |
|
BlackSwan
Messages: 26766 Registered: January 2009 Location: SoCal
|
Senior Member |
|
|
qazims92 wrote on Fri, 28 October 2016 05:12Hi Experts,
When we execute following command on 11.2.0.1, we get result.
But when we execute same command on 11.2.0.4.0 then we get ORA-06502.
select UTL_RAW.cast_to_number(rawtohex(to_char(trim('JSC010')))) from dual;
Kindly guide.
Regards,
Qazi
06502, 00000, "PL/SQL: numeric or value error%s"
// *Cause: An arithmetic, numeric, string, conversion, or constraint error
// occurred. For example, this error occurs if an attempt is made to
// assign the value NULL to a variable declared NOT NULL, or if an
// attempt is made to assign an integer larger than 99 to a variable
// declared NUMBER(2).
// *Action: Change the data, how it is manipulated, or how it is declared so
// that values do not violate constraints.
DUAL is defined as being only 1 character wide.
|
|
|
Re: ORA-06502 with UTL_RAW [message #657128 is a reply to message #657123] |
Fri, 28 October 2016 07:25 |
John Watson
Messages: 8938 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I surprised it ever worked, because it is full of bugs. You are passing a string to to_char instead of a date or number; a string to rawtohex when it should be a raw; a string to utl_raw.cast_to_number when it should be a raw.
|
|
|
|
|
|
|
|
|
|
Re: ORA-06502 with UTL_RAW [message #657202 is a reply to message #657199] |
Tue, 01 November 2016 03:28 |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
Hmmm, you didn't actually answer the question.
What are you actually trying to do? What problem are you trying to solve?
Are you just 'playing' with data to see what you can and cannot do with it? If so, fair play, but you have already had your answer in terms of what is wrong with your code.
Do you have an issue with data that you have in your database? If so, describe the issue, post a test case, tell us what is needed to resolve the issue and someone will most likely be able to assist.
|
|
|
|
|