title: How to declare variable and use it in the same Oracle SQL script?
body: <p>I want to write reusable code and need to declare some variables at the beginning and reuse them in the script, such as:</p>
  
  <pre><code>DEFINE stupidvar = 'stupidvarcontent';
  
  SELECT stupiddata
  FROM stupidtable
  WHERE stupidcolumn = &amp;stupidvar;
  </code></pre>
  
  <p>How can I declare a variable and reuse it in statements that follow such as in using it SQLDeveloper.</p>
  
  <hr>
  
  <p><strong>Attempts</strong></p>
  
  <ul>
  <li>Use a DECLARE section and insert the following SELECT statement in <code>BEGIN</code> and <code>END;</code>. Acces the variable using <code>&amp;stupidvar</code>.</li>
  <li>Use the keyword <code>DEFINE</code> and access the variable.</li>
  <li>Using the keyword <code>VARIABLE</code> and access the the variable.</li>
  </ul>
  
  <p>But I am getting all kinds of errors during my tries (Unbound variable, Syntax error, Expected <code>SELECT INTO</code>...).</p>