Definition:
In Oracle PL/SQL, SELF_IS_NULL is a system defined exception. The error number associated with the exception is -30625. Oracle server implicitly raises this exception when the program tries to call a MEMBER function for a NULL or a non initialized object instance. The built-in parameter SELF points to the object, and is always the first parameter passed to a MEMBER method.
Example Usage:
The example below shows an object table MEM_TAB holding instances of MEM_TYPE object type. The member procedure SHOW_NAME displays value of "name" attribute of the object instance. If the member method is invoked for a non initialized instance, Oracle raises the ORA-30625 exception i.e. SELF_IS_NULL
SQL> CREATE TYPE MEM_TYPE AS OBJECT (
idno NUMBER,
name VARCHAR2(20),
MEMBER PROCEDURE SHOW_NAME ( SELF IN OUT NOCOPY MEM_TYPE ));
/
Type created.
SQL> CREATE TYPE BODY MEM_TYPE AS
MEMBER PROCEDURE SHOW_NAME ( SELF IN OUT NOCOPY MEM_TYPE ) IS
BEGIN
DBMS_OUTPUT.PUT_LINE(TO_CHAR(idno) || ' ' || name);
END;
END;
/
Type body created.
SQL> CREATE TABLE MEM_TAB OF MEM_TYPE;
Table created.
SQL> INSERT INTO MEM_TAB VALUES (MEM_TYPE(1, 'PSOUG') );
1 row created.
SQL> SELECT VALUE(p) FROM MEM_TAB p WHERE p.name = 'PSOUG';
VALUE(P)(IDNO, NAME)
-------------------------------
MEM_TYPE(1, 'PSOUG')
SQL> DECLARE
L_TEST MEM_TYPE;
BEGIN
SELECT VALUE(p) INTO L_TEST FROM MEM_TAB p WHERE p.idno = 1;
L_TEST.SHOW_NAME();
END;
/
1 PSOUG
PL/SQL procedure successfully completed.
SQL> DECLARE
L_TEST MEM_TYPE;
BEGIN
L_TEST.SHOW_NAME();
END;
DECLARE
*
ERROR at line 1:
ORA-30625: method dispatch on NULL SELF argument is disallowed
ORA-06512: at line 4
Related Links: