title: Oracle PLSQL setting a cursor from a variable
body: <p>Im new to cursors in Oracle. I have a piece of SQL that is contained in a variable. I want to open a cursor with this sql. How do I do this? Seems simple but all the examples I find just have the sql typed directly below the "open cursor_name for" statement.</p>
  
  <p>Here is what I would like to run (assume I have variable v_sql with my sql query):</p>
  
  <pre><code>open my_cursor for v_sql;
  </code></pre>
  
  <p>Oracle doesnt like this though. I also tried </p>
  
  <pre><code>open my_cursor for 
    execute immediate v_sql;
  </code></pre>
  
  <p>Help please.</p>