title: How to set initial generator value?
body: <p>I need to initialise a new Firebird generator / sequence to the max primary key value of an existing, 'old' table. I tried the following but it is not working, I get the error "Token unknown - line 6, column 8 select". I cannot do this manually as it must be executed on many different DBs. I am using Firebird 2.5.1. </p>
  
  <p>According to <a href="http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-execblock.html" rel="nofollow">http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-execblock.html</a> this should work - what am I doing wrong?  </p>
  
  <pre class="lang-sql prettyprint-override"><code>set term #;  
  execute block  
  as  
  declare i int = 0;  
  begin  
     i = select max(ID) from OrganizationType_OLU;  
      alter sequence OrganizationType_OLU restart with :i;  
  end  
  #  
  set term ;# 
  </code></pre>