title: creating variables in PL/SQL
body: <p>Simple PL/SQL question from a beginner: What is the proper PL/SQL syntax for creating a new variable in an existing dataset? </p>
  
  <p>I'd like to extract the year from a date field (svcdat) in an insurance claims dataset (rpt_claim). The date field is numerical and follows the format YYYYMMDD, for example 20120704 for July 4, 2012.</p>
  
  <p>My first pass at creating a "year" variable was unsuccessful:</p>
  
  <pre><code>declare
    year number(4);
  begin
    select svcdat into year 
    from rpt_claim
    where year=floor(svcdat/10000);
  end;
  </code></pre>
  
  <p>Any help is much appreciated!</p>