Search code examples
oracle-databaseobjectplsqlrecorddestroy

Destroy Oracle PLSQL Object


Is there a way to destroy a PL/SQL object, say, a record?

In visual pascal, we can use FreeAndNil(object), and this procedure releases the memory used by the object and points it to Nil (null), thus destroying the object.

I was wondering if there's a way to do that on PLSQL object/record, or if I should assign null to it.


Solution

  • You can set a row type to null, no problem.

    This compiles fine:

    declare
      r dual%rowtype;
    begin
      r := null;
    end;
    

    If a variables looses scope (so after end; here), Oracle will automatically destroy it, so there is no need to set it to null, or deallocate it in any way.