How can I define a parameterless constructor in an Oracle PL/SQL type? I've tried this:
create or replace type FooBar as object
(
constructor function FooBar() return self as result
);
...
foo_bar := FooBar();
But the empty parameter list in the type declaration raises PLS-00103.
you don't need brackets after the name of the parameterless function and you need a definition for the body ot the constructor:
create or replace type FooBar as object
(
bar NUMBER(1,0)
,constructor function FooBar return self as result
);
/
create or replace type body FooBar is
constructor function FooBar return self as result
IS
BEGIN
RETURN;
END;
end;
/
declare
foo foobar;
begin
foo := foobar();
end;
/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.