title: Declare multiple variables in an Oracle SQL function
body: <p>I wish to use multiple local variables in my SQL block but I always get some errors. I only have to <code>return</code> the <code>sum of salary</code>. Any ideas?</p>
  
  <pre><code>function Foo(projekt varchar2)
  return number
    is sumSalary number;
    cursor kurzor is (
       select * 
         from (hr.employees inner join hr.workon using (employee_id))
              inner join hr.proj using (projno));
    oneLine kurzor%ROWTYPE;
  begin
    sumSalary := 0;
    for oneLine in kurzor
    loop
      if oneLine.pname = projekt then
        dbms_output.put_line(concat(concat(oneLine.first_name,' '),oneLine.last_name));
        sumSalary := sumSalary+ oneLine.salary;
      end if;
      if oneLine.salary &gt; 7500 then
        insert into HighSalary values(oneLine.first_name,oneLine.salary);
      end if;
    end loop;
  exception
    when others then
      dbms_output.put_line('asd');
  end;
  </code></pre>
  
  <p>My error:</p>
  
  <blockquote>
    <p>Error report: ORA-06550: line 2, column 1: PLS-00201: identifier
    'SUMSALARY' must be declared ORA-06550: line 2, column 1: PL/SQL:
    Statement ignored ORA-06550: line 3, column 15: PLS-00201: identifier
    'KURZOR' must be declared ORA-06550: line 3, column 1: PL/SQL:
    Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:</p>
  </blockquote>