title: Trouble using Oracle SQL variable in where clause
body: <p>I'm trying to write a script to help assist with the numerous "What's happened to this actionlist" type calls, but i'm coming up against a brick wall doing some of the most simplest operations.</p>
  
  <p>I'm trying to declare a variable and use it in the where clause of a query.  I've trimmed everything irrelevant out of the query, in an attempt to get this core functionality to work.</p>
  
  <p>The id is usually an 18 digit number, but does occasionally contain alpha-numerics, hence why it is a varchar.  The column I'm trying to compare it to is an 18 byte varchar field.</p>
  
  <pre><code>declare
    id_to_check VARCHAR(18);  
  
  begin
    id_to_check := '549576015500000109';
  
  select 
    txn_timestamp, exception_type
  from cut.event
  where irn_id = id_to_check;
  
  end;
  </code></pre>
  
  <p>Every time it throws an error:  'an INTO clause is expected in this select statement'.  I understand how INTO's work, i.e. if I wanted to assign the result of a select to the variable, but I don't understand how that would apply in this instance as I'm not assigning the result of the query to a variable?</p>
  
  <p>The other frustrating thing is I'm actually following documentation on docs.oracle.com.</p>
  
  <p><a href="http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/overview.htm#LNPLS001" rel="nofollow">http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/overview.htm#LNPLS001</a>.</p>
  
  <p>I've also looked at various google results, but I can't figure out how to do a comparison with the variable without first selecting something into it, but as you can see, I can't select into because I only need it for comparison reasons?</p>
  
  <p>Kind Regards,
  Ian</p>