title: PL/SQL Write a procedure to update a column?
body: <p>I am supposed to update a students grade to 'A' based on procedure </p>
  
  <pre><code>ChangeGrade(p_sID, p_classID)
  </code></pre>
  
  <p>If the student is not enrolled in the class (p_classID) then an error message is printed. </p>
  
  <p>Here is the table:</p>
  
  <p>Enrolling</p>
  
  <pre><code>sID    classID   Grade
  ***    *******   *****
  104      10440     B
  102      10220     C
  ...      .....     .
  </code></pre>
  
  <p>Am I supposed to do an inner join? Here's what I have:</p>
  
  <pre><code>Create or Replace ChangeGrade (
    p_sID enrolling.sID%type
    p_classID enrolling.classID%type )
  AS
    p_id_enrolled NUMBER;
  
  BEGIN
    SELECT sID into p_id_enrolled 
    FROM Enrolling
    WHERE sID = p_sID
    AND classID = p_classID
  
    IF p_sID = p_id_enrolled THEN
      update Enrolling
      set GRADE = 'A'
      dbms_output.put_line('Student grade has been changed.')
    ELSE
      dbms_output.put_line('Student record does not exist.')
    END IF;
  END;
  /   
  </code></pre>