title: PLSQL Count and Procedure
body: <p>Currently trying to create a PL/SQL procedure. I am a complete noob at PL/SQL, as you can tell!</p>
  
  <p>We have had to create a table using SQL, and we are looking to automatically update the table with a procedure. If the customer has requested more than 4 jobs, we are looking to input their details into this table as a frequent customer. </p>
  
  <p>I currently have at the moment:</p>
  
  <pre><code> CREATE TABLE PublisherDetails
   (PublisherName VARCHAR2 (40),
   City VARCHAR2 (20) ,
   PhoneNo NUMBER (11),
   jobNo NUMBER (10),
    startDate DATE,
   completionDate DATE)
   ;
  
   SELECT Publisher.Name AS PublisherName,
   Publisher.City, Publisher.PhoneNo,
   COUNT (*) AS PublisherJobCount
   FROM Publisher
   INNER JOIN PrintJob
   ON Publisher.Name = PrintJob.PublisherName
   GROUP BY Publisher.Name, Publisher.City, Publisher.PhoneNo;
  
  Create or replace procedure Task3
  IS CountPublisherJobs NUMBER;
  DECLARE No_data_Found EXCEPTION
  BEGIN
  SELECT count(*) INTO CountPublisherJobs 
  OPEN Task3;
  LOOP
  IF PublisherJobCount &lt; 3
  THEN INSERT INTO PublisherDetails (PublisherName, City, PhoneNo)
  FROM Publisher
  WHERE PublisherName = publisher.name
  Else
              Insert Into PublisherDetails (JobNo, StartDate, CompletionDate )
              SELECT jobNo, startDate, completionDate
              FROM PrintJob
              Where PublisherName = publishers.name
    FETCH Task3 INTO PublisherDetails, publishername, city, phoneNo;
    EXIT WHEN c1%NOTFOUND;  
  
      INSERT INTO temp VALUES (PublisherName, City, PhoneNo, JobNo, StartDate, CompletionDate);
  END IF;
      COMMIT;
  END LOOP;
  EXCEPTION
      WHEN NO_DATA_FOUND THEN
          dbms_output.put_line('Sorry no data found');
      END;
      /
  </code></pre>
  
  <p>Its churning up errors and I am not sure why. Any help as always is appreciated. </p>