oracle - Problems using clob as a parameter to a constructor -
i have following pl/sql code:
create type testingclob object ( member_value number, constructor function testingclob( i_aclob clob ) return self result ); / create type body testingclob constructor function testingclob( i_aclob clob ) return self result begin member_value := 0; return; end; end; / declare l_test testingclob; begin l_test := new testingclob('some text'); end;
but error
ora-06550: line 5, column 18: pls-00307: many declarations of 'testingclob' match call ora-06550: line 5, column 4:
the compilation of type works fine. appears cannot use constructor. know doing wrong?
the parameter 'some text'
should declared clob.
declare l_param clob; l_test testingclob; begin l_param:= 'some text'; l_test := new testingclob(l_param); end;
by default, system supplies default constructor accepts parameter corresponding each attribute, see https://docs.oracle.com/cd/b13789_01/appdev.101/b10807/10_objs.htm#i16312 chapter 'defining object constructors'. therefore constructor cannot determined because none of them hits input parameter varchar2.
try
begin l_test := new testingclob(1); end;
this default constructor.
Comments
Post a Comment