我有以下PL / SQL代码:
create type testingclob as object (
member_value number,
constructor function testingclob(
i_aclob clob
) return self as result
);
/
create type body testingclob as
constructor function testingclob(
i_aclob clob
) return self as result
is
begin
member_value := 0;
return;
end;
end;
/
declare
l_test testingclob;
begin
l_test := new testingclob('some text');
end;
但是我得到了错误
ORA-06550: line 5, column 18:
PLS-00307: too many declarations of 'TESTINGCLOB' match this call
ORA-06550: line 5, column 4:
该类型的编译工作正常。但是,看来我不能使用构造函数。有人知道我在做什么错吗?
该参数'some text'
应声明为clob。
declare
l_param clob;
l_test testingclob;
begin
l_param:= 'some text';
l_test := new testingclob(l_param);
end;
默认情况下,系统会提供一个默认构造函数,该构造函数接受与每个属性相对应的参数,请参阅https://docs.oracle.com/cd/B13789_01/appdev.101/b10807/10_objs.htm#i16312章节“定义对象构造函数” 。因此,不能确定构造函数,因为它们都没有命中输入参数varchar2。
尝试
begin
l_test := new testingclob(1);
end;
这是您的默认构造函数。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句