TOracleObject & Static methods?

BradBrown

Member
I was wondering how to call a static method using TOracleObject. I wrapped a constructor for an Oracle object within a static function, as in:

STATIC FUNCTION Construct
RETURN CAnyItem IS
BEGIN
RETURN CAnyItem(1, 2, 3, 4, 5, 6, 7);
END;

The only way I know of calling this function from Delphi is via TOracleObject.CallComplexMethod
and when I do, I receive a "PLS-00587. A Static method cannot be invoked on an instance value' - which seems logical. Can anyone tell me how to initialize my object by calling my wrapped constructor via TOracleObject?

Thanks
 
Static methods cannot be called through the TOracleObject interface yet. This will be available in the next release. There is a work around though. Just define a TOracleQuery with a PL/SQL Block like this:
Code:
begin
  :Result := CAnyItem.Construct();
end;
If you define the :Result variable of type object, you can execute the query like this:
Code:
var
  AnyItem: TOracleObject;
begin
  // Create an object instance of the correct type
  AnyItem := TOracleObject.Create(Session, 'CAnyItem', '');
  // Assign it to the result variable
  Query.SetComplexVariable('Result', AnyItem);
  // Exexute the static method
  Query.Execute;
  // AnyItem will now be initialized
end;
I hope this helps.

------------------
Marco Kalter
Allround Automations
 
Back
Top