The InternalDebug function receives a DebugQuery parameter. This is the TOracleQuery instance that is being executed. If it is executed by a TOracleDataSet, this is the internal TOracleQuery instance that is uses. You cannot determine to which TOracleDataSet instance it belongs.