title: copy oracle sequence to test schema, convert to PL/Sql procedure
body: <p>I have this sql which copies (actually recreates) a sequence from a productive scheme to a test scheme in Oracle, how do i make a procedure from this that i can use as follows ? Suppose all grants are ok and all names are the same in the test scheme.</p>
  
  <p>desired syntax</p>
  
  <pre><code>copy_sequence &lt;name_of_sequence&gt; &lt;connectstring_prod_scheme&gt; &lt;connectstring_test_scheme&gt; 
  </code></pre>
  
  <p>sql</p>
  
  <pre><code>connect test/testpw@db.srv;
  
  declare
   val    number(21);
   s_sql varchar2(200);
  begin
   --use the select on the productive db to get the current value
   select prod.seq.nextval into val from dual;
   s_sql := 'drop sequence seq';
   execute immediate s_sql;
   s_sql := 'create sequence seq minvalue 1 maxvalue 999999999999999999999 start with '||val||' increment by 1';
   execute immediate s_sql;
  end;
  /
  </code></pre>