Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> PL/SQL - NULL SELF error on member function

PL/SQL - NULL SELF error on member function

From: <newdb_at_my-deja.com>
Date: 2000/04/24
Message-ID: <8e20lb$uoc$1@nnrp1.deja.com>#1/1

Guys,
I am getting an "ORA-30625: method dispatch on NULL SELF argument is disallowed" when calling a method that is a function of an object type. The purpose of the table seq_id is providing a sequence number (there are some reasons why we can't use sequences). A script is included bellow, after the error msg. Thanks in advance.

The error shows as listed here:
SQL> exec p_seq
BEGIN p_seq; END;
*
ERROR at line 1:

ORA-30625: method dispatch on NULL SELF argument is disallowed
ORA-06512: at "P_SEQ", line 14
ORA-06512: at line 1


Script:
drop table seq_id;
CREATE or REPLACE TYPE o_sequence AS OBJECT (

  table_nm        varchar2(30),
  column_nm       varchar2(30),
  next_id         number,
  MEMBER FUNCTION get_next_id (par_table_nm IN varchar2,
  				    par_column_nm IN varchar2,
				    par_nr IN OUT NUMBER)
   	RETURN	 integer

 );
/

create table seq_id of o_sequence;
insert into seq_id values (1,'mytable','mycolumn'); commit;
create or replace type body o_sequence as
	member function get_next_id (par_table_nm  IN    varchar2,
  					par_column_nm    IN   varchar2,
					par_nr IN OUT NUMBER)
  	return integer  as
	w_qty integer;
   begin
	select next_id into w_qty from seq_id
		where table_nm = par_table_nm and column_nm =
par_column_nm
 		for update;
	if par_nr > 1 then
		w_qty := w_qty + par_nr;
	end if;
	update seq_id set next_id = w_qty + 1 ;
	return w_qty;

   end get_next_id;
end;
/

create or replace procedure p_seq is

	w_id number;
	w_tb varchar2(30);
      w_c  varchar2(30);
	w_objseq o_sequence;
begin
	w_id := 0;
      w_tb := 'mytable';
	w_c := 'mycolumn';
      dbms_output.put_line('Starting...');
	/* initialize the instance of object o_sequence /*
	w_objseq := o_sequence(null,null,null);
	/* calls the procedure with params */
      w_id := w_objseq.get_next_id(w_tb,w_c,w_id);
      dbms_output.put_line(w_id);

end;
/

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Apr 24 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US