|René Nyffenegger's collection of things on the web|
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
July 18, 2005: On the missing super keyword in PL/SQL
Suppose, I have a type (named base_type) defined as follows:
create type base_type as object ( dummy number, -- prevent PLS-00589: no attributes found in object type "BASE_TYPE" member procedure proc_1 ) not final not instantiable; / create type body base_type as member procedure proc_1 is begin dbms_output.put_line('base_type: proc_1'); end proc_1; end; /
Then, I derive a new type from base_type (named deriv_type):
create type deriv_type under base_type ( overriding member procedure proc_1, member procedure proc_2 ); / create type body deriv_type as overriding member procedure proc_1 is begin dbms_output.put_line('deriv_type: proc_1'); end proc_1; member procedure proc_2 is begin self.proc_1; --super.proc_1; end proc_2; end; /
Now, I want to call base_type's proc_1 from deriv_type's proc_2. Every Java programmer would assume that there is a
However, that's not the case. The key phrase in the manual is: When implementing methods using PL/SQL, you cannot call a base or supertype object method with the super keyword or an equivalent method in a derived object. See Oracle Database Application Developer's Guide - Object-Relational Features for additional information on supertypes, subtypes, and object methods..
Ok. I understand.
More on Oracle
This is an on Oracle article. The most current articles of this series can be found here.