title: Oracle: DML operation inside a query
body: <p>I'm getting this error: </p>
  
  <pre><code>cannot perform a DML operation inside a query
  </code></pre>
  
  <p>when i tried to execute the query </p>
  
  <pre><code>select st_atten_up(1,7) from dual;
  </code></pre>
  
  <p>the code has given below.</p>
  
  <pre><code>create or replace FUNCTION st_atten_up(stu_id IN student_info.id%type,app_mon IN student_attendence.month%type) 
  RETURN NUMBER 
  IS 
  att1 NUMBER;
  BEGIN SELECT ATTENDANCE into att1 FROM student_attendence 
  WHERE student_attendence.id = stu_id and student_attendence.month = app_mon; 
  att1 := att1 + 1;
  UPDATE student_attendence SET ATTENDANCE = att1 
  where id = stu_id and month = app_mon;
  return att1;
  END;
  </code></pre>
  
  <p>Thanks in advance.</p>