Home » SQL & PL/SQL » SQL & PL/SQL » error ORA 210001
error ORA 210001 [message #656954] Mon, 24 October 2016 12:00 Go to next message
yk107
Messages: 15
Registered: October 2015
Junior Member
Hello we received an error ,from this chunk of code

EXCEPTION
WHEN OTHERS then

err_msg := 'Error encounted --> ' || sqlcode || substr(sqlerrm,1,100 ) || to_char( r_main.pidm ) ;

dbms_output.put_line(err_msg);
Raise_Application_Error ( sqlcode , substr(sqlerrm,1,50) || to_char( r_main.my_data ) );


error ORA 210001

sqlcode variable is initialized by oracle , how range of this variable is wrong

Thanks
Re: error ORA 210001 [message #656955 is a reply to message #656954] Mon, 24 October 2016 12:14 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
yk107 wrote on Mon, 24 October 2016 10:00
Hello we received an error ,from this chunk of code

EXCEPTION
WHEN OTHERS then

err_msg := 'Error encounted --> ' || sqlcode || substr(sqlerrm,1,100 ) || to_char( r_main.pidm ) ;

dbms_output.put_line(err_msg);
Raise_Application_Error ( sqlcode , substr(sqlerrm,1,50) || to_char( r_main.my_data ) );


error ORA 210001

sqlcode variable is initialized by oracle , how range of this variable is wrong

Thanks
I don't believe you.
AFAIK, Oracle error number is maximum 5 digits long; not 6

The EXCEPTION handler is junk.
It should be completely REMOVED & DELETED since it does more harm than Good.

use COPY & PASTE to avoid posting incorrect "facts".
Re: error ORA 210001 [message #656956 is a reply to message #656954] Mon, 24 October 2016 12:18 Go to previous messageGo to next message
Michel Cadot
Messages: 68644
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Read WHEN OTHERS.

Re: error ORA 210001 [message #656957 is a reply to message #656956] Mon, 24 October 2016 12:21 Go to previous messageGo to next message
Michel Cadot
Messages: 68644
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

In addition, "Raise_Application_Error ( sqlcode " is wrong as you can't raise with this function an error that is not in the range [-20999,-20000].

Re: error ORA 210001 [message #656958 is a reply to message #656955] Mon, 24 October 2016 12:23 Go to previous messageGo to next message
yk107
Messages: 15
Registered: October 2015
Junior Member
Thank you black swam
error was ora 21001

I will delete this statement
Thanks
Re: error ORA 210001 [message #656959 is a reply to message #656958] Mon, 24 October 2016 12:26 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
yk107 wrote on Mon, 24 October 2016 10:23
Thank you black swam
error was ora 21001

I will delete this statement
Thanks
I see that you are consistent; consistently wrong.

use COPY & PASTE to avoid misrepresenting reality

CEASE & DESIST writing any EXCEPTION handler code

post actual & complete run time error
Re: error ORA 210001 [message #656967 is a reply to message #656959] Mon, 24 October 2016 13:22 Go to previous messageGo to next message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
exception handling is fine, however try to avoid the use of WHEN OTHERS because it masks any existing problems. An unhandled exception should blow up so you can see the error report and know exactly where and what the problem is.
Re: error ORA 210001 [message #656990 is a reply to message #656967] Tue, 25 October 2016 03:14 Go to previous message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Just to be clear the error you actually got is this:
> oerr ora 21000
21000, 00000, "error number argument to raise_application_error of %s%s is out of range"
// *Cause:
// *Action: Use an error number in the range of -20000 to -20999, inclusive.

As the error message (and the documentation) says you can only use values between -20000 and -20999. Any error that wasn't the result of a call to raise_application_error will have a different error number.
Raise_application_error exists so you can create custom errors, it is not there to reformat existing oracle errors.
Read the link Michel posted.
Delete that pointless exception handler.
And next time you get an error and want help here make sure you post the correct error number.
Previous Topic: Can we update "last_update_date" on Closed\Cancelled Orders using API
Next Topic: worklist sql
Goto Forum:
  


Current Time: Wed Apr 24 07:34:45 CDT 2024