我需要在函数中每秒执行相同的查询GetStuff,但是在一两分钟后 Oracle 抛出 ORA-00604 并用完游标,我想我需要在返回结果后以某种方式关闭打开的游标。但是我不喜欢每次需要查询时都重新连接的想法,我的代码如下:
public MyStuff GetStuff(string paramValue)
{
    OracleCommand command = connection.CreateCommand();
    command.CommandText = "select XXX from YY where param = ? ";
    command.Parameters.Add(":param ", OracleDbType.Varchar2).Value = paramValue;
    IDataReader reader = command.ExecuteReader();
    while (reader.Read())
    {
       ...
    }
    command.Dispose();
    return stuff;
 }