title: Insert Data Into Table with Stored Procedure in Oracle SQL
body: <p>I am working through a homework assignment and am stuck on a problem with stored procedures.</p>
  <p>I have the following tables:</p>
  <pre><code>create table Restaurant(rID int, name varchar2(100), address varchar2(100), cuisine varchar2(100));
  create table Reviewer(vID int, name varchar2(100));
  create table Rating(rID int, vID int, stars int, ratingDate date);
  </code></pre>
  <p>For my stored procedure I need to create, I get an input of a restaurant name (unique), reviewer name(unique), star rating, and review date.  I need to update the Rating table with the proper information, and add a new reviewer to the Review table if they have not previously existed in the table.</p>
  <p>In order to start my stored procedure, I wanted to start with just creating a new table called newReview to get the inputs stored in a new table, before re-writting to update the existing tables.</p>
  <p>Here is the newReview Table</p>
  <pre><code>CREATE TABLE newReview(
      RestaurantName VARCHAR(100),
      UserName VARCHAR(100),
      Stars Int,
      RatingDate Date
  )
  </code></pre>
  <p>This is my AddNewReview procedure, which compiles with success:</p>
  <pre><code>CREATE OR REPLACE PROCEDURE AddNewReview(
    RESTAURANTNAME IN VARCHAR2 (100)
  , USERNAME IN VARCHAR2 (100)
  , Stars IN NUMBER 
  , RATINGDATE IN DATE 
  ) AS 
  BEGIN
    INSERT INTO newReview VALUES (RestaurantName, UserName, Stars, RatingDate);
  END AddNewReview;
  ;
  </code></pre>
  <p>However, when I run the stored procedure with inputs as such,</p>
  <pre><code>BEGIN
      AddNewReview ('Rangoli', 'Sarah M.', 4, '2020-11-21');
  END; 
  </code></pre>
  <p>I get the following error:</p>
  <pre><code>Error starting at line : 20 in command -
  BEGIN
      AddNewReview ('Rangoli', 'Sarah M.', 4, '2020-11-21');
  END;
  Error report -
  ORA-06550: line 2, column 5:
  PLS-00905: object TOCONN22.ADDNEWREVIEW is invalid
  ORA-06550: line 2, column 5:
  PL/SQL: Statement ignored
  06550. 00000 -  &quot;line %s, column %s:\n%s&quot;
  *Cause:    Usually a PL/SQL compilation error.
  *Action:
  </code></pre>
  <p>I have tried defining the date input as <code>DATE '2020-11-21'</code> and also switching the single quote to double.  Where am I going wrong, as this is the first stored procedure I am writing.</p>