Ora-01000 - maximum open cursors exceeded error
        Posted  
        
            by 
                PeteDaMeat
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by PeteDaMeat
        
        
        
        Published on 2011-01-06T13:36:53Z
        Indexed on 
            2011/01/06
            14:54 UTC
        
        
        Read the original article
        Hit count: 339
        
I am receiving the following error message within my Delphi/Oracle application "ora-01000 - maximum open cursors exceeded". The code is as follows:
begin
  for i := 0 to 150 do 
  begin
    with myADOQuery do
    begin
      SQL.Text := 'DELETE FROM SOMETABLE';
      ExecSQL; -- from looking at V$OPEN_CURSOR a new cursor is added on each iteration for the session
      Close; -- thought this would close the cursor but doesn't
    end;
  end;
end;
I'm aware I can resolve the problem by simply increasing the number of OPEN_CURSORS parameters, however, I would rather find a solution whereby the cursor is closed after the query is executed. Any ideas?
Delphi 2006 BDS Oracle 10g
© Stack Overflow or respective owner