Home » SQL & PL/SQL » SQL & PL/SQL » Overriding the pre-defined Functions in oracle (Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi)
Overriding the pre-defined Functions in oracle [message #550647] Wed, 11 April 2012 05:04 Go to next message
saipradyumn
Messages: 175
Registered: October 2011
Location: Hyderabad
Senior Member
Hi

Can we override the pre defined functions in oracle.
I am able to do this in my schema.
But if DB server contains more than one schema do I need to write the same procedure in all schemes.
we can call the same procedure with schema name from different schemes also .
But is there any way to over ride the actual function provided by oracle (just like over riding the equals method of object class in java).


create or replace function to_number(var varchar2) return number 
is
  no number := var;
begin
  return 99999;
end;

SQL> select to_number('  234  ') oracle_function , dbo.to_number(234) user_function from dual;
 
ORACLE_FUNCTION USER_FUNCTION
--------------- -------------
            234         99999



Thanks
Sai Pradyumn
Re: Overriding the pre-defined Functions in oracle [message #550649 is a reply to message #550647] Wed, 11 April 2012 05:10 Go to previous messageGo to next message
cookiemonster
Messages: 10571
Registered: September 2008
Location: Rainy Manchester
Senior Member
NO.
Re: Overriding the pre-defined Functions in oracle [message #550655 is a reply to message #550647] Wed, 11 April 2012 05:54 Go to previous messageGo to next message
Michel Cadot
Messages: 57603
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Hopefully you can't!
And I should say, anyone that writes such thing should be fire and banned away from any Oracle database for the rest of his life.

Regards
Michel
Re: Overriding the pre-defined Functions in oracle [message #550677 is a reply to message #550655] Wed, 11 April 2012 08:36 Go to previous messageGo to next message
Solomon Yakobson
Messages: 1788
Registered: January 2010
Senior Member
Michel Cadot wrote on Wed, 11 April 2012 06:54
Hopefully you can't!


Yes it can be done and it is not that difficult (as long as you have SYSDBA access). Obviously, as soon as you do it you violate license agreement. And in most cases you'll get unexpected results possibly resulting in database corruption since many built-in functions are also used internally.

SY.
Re: Overriding the pre-defined Functions in oracle [message #550679 is a reply to message #550677] Wed, 11 April 2012 08:58 Go to previous message
Michel Cadot
Messages: 57603
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You also can hacking the binary code (and doing so as SYS is also hacking).
When I say "you can't" it is underlying using standard user and normal way.

Regards
Michel
Previous Topic: Re: How to Schedule a Procedure on Oracle 10g (split from hijacked thread by bb)
Next Topic: Re: I got a problem while writing a simple procedure (split from hijacked thread by bb)
Goto Forum:
  


Current Time: Wed Apr 16 15:03:56 CDT 2014

Total time taken to generate the page: 0.10649 seconds