title: check for last row in for loop plsql
body: <p>I am using FOR Loop in plsql for students and departments and storing department names in log table separated by commas, but I get extra ',' after last department name how to remove it?</p>
  
  <pre><code>For i IN
   (select (DEPT_NAME) DeptName FROM TBL_DEPT WHERE PREV_DEPT_NAME = 
  lPrevDeptName)
  LOOP
   lNewDept := lNewDept || i.DeptName || ',';
  
  ...
  .....
  ....
  END LOOP;
  </code></pre>
  
  <p>and I am updating log table with new deptname at last, but i am getting result like 'IT,HR,Accounts,' in log table, want to remove extra ',' after Accounts</p>