title: PL/SQL : How to display subject title and lecturer names in a procedure?
body: <p>My procedure will take in an subject code as a parameter and the proceed to display the subject title and lecturers’ names who have taught the subject before 2016. My procedure should also prompt input a subject code and display the results. I tried my code as following without putting it into a procedure and it returns the correct results but when I include my code as part of a PL/SQL procedure, I get an error that says</p>
  
  <blockquote>
    <p>Warning: Procedure created with compilation errors.</p>
  </blockquote>
  
  <p>I am quite new to PL/SQL so any advices would be helpful! The procedure code that I had been trying for hours as follow:</p>
  
  <pre><code>    CREATE OR REPLACE PROCEDURE WHO(CODE CHAR)
  IS
  FNAME VARCHAR(256)
  LNAME VARCHAR(256)
  TITLE VARCHAR(256)
  
  CURSOR C1
  IS
      SELECT FIRST_NAME, LAST_NAME, SUBJECT.NAME
      FROM ACADEMIC INNER JOIN TEACHES
      ON STAFF# = LECTURER
      INNER JOIN SUBJECT
      ON TEACHES.CODE=SUBJECT.CODE
      WHERE YEAR&lt;2016 AND TEACHES.CODE=CODE
      GROUP BY FIRST_NAME, LAST_NAME, SUBJECT.NAME;
  BEGIN
      OPEN C1;
      LOOP
      IF C1%NOTFOUND THEN EXIT;
      END IF;
      FNAME=FIRST_NAME;
      LNAME=LAST_NAME;
      DBMS.OUTPUT.PUT_LINE(FNAME||' '||LNAME);
      TITLE=SUBJECT.NAME;
      DBMS.OUTPUT.PUT_LINE(TITLE);
      END LOOP;
      CLOSE C1;
  END WHO;
  /
  </code></pre>