bug or feature in test of object types

Alex.A.

Member
hi,
it looks like bug, but maybe is a feature that i can#t understand

i have object types with different overloaded constructor.
so i want to test one of them, right click> Test
and get the generated code like

SQL:
declare
 result scott.myobj;
 obj myobj;
begin
  obj := myobj(myobj_id => :a_myobj_id ...[other object variable]..);
  --call method
  result := obj.myobj;
end;

so if you look on inititialization of result its look strange for me.
why is the initialized object call self constructor?

Thx,
alex
 
i haven't told, we are using 9.0.1 version

SQL:
create or replace type myobj as object
(
  -- Created : 15.09.2011 14:38:30
  -- Purpose :

  -- Attributes
  myobj_id NUMBER,
  myobj_name VARCHAR2(2),

  CONSTRUCTOR FUNCTION  myobj RETURN SELF AS RESULT,
  CONSTRUCTOR FUNCTION  myobj(myobj_id NUMBER) RETURN SELF AS RESULT

)NOT FINAL
/
create or replace type body myobj is

  -- Member procedures and functions
  CONSTRUCTOR FUNCTION  myobj RETURN SELF AS RESULT
  IS
  BEGIN
    self.myobj_id := 1;
    self.myobj_name := 'myobj';
    RETURN;
  END;

  CONSTRUCTOR FUNCTION  myobj(myobj_id NUMBER) RETURN SELF AS RESULT
  IS
  BEGIN
    self.myobj_id := myobj_id;
    self.myobj_name := 'myobj';
    RETURN;
  END;

end;
/


generated test block


SQL:
declare
  -- Non-scalar parameters require additional processing
  result scott.myobj;
  -- Declare a local myobj instance
  obj myobj;
begin
  -- Call the default constructor for the myobj instance
  obj := myobj(myobj_id => :a_myobj_id,
               myobj_name => :a_myobj_name);
  -- Call the method
  result := obj.myobj(myobj_id => :myobj_id);
end;
 
Back
Top