Note that there are some explanatory texts on larger screens.

plurals
  1. POPLSQL error: Encountered the symbol when expecting: in procedure
    primarykey
    data
    text
    <p>I am new to PL/SQL, written a procedure and could not spot the error.<br> Implementation Details:<br> I am using few cursors to traverse through a table and store some relevant data in a nested table <code>(TYPE .. IS TABLE OF varchar(8))</code>.<br> Specifically, table prerequisites stores prereq courses of a given course. I have to find direct prereqs of a given course and the prereqs of the prereqs, if any.<br> Code:<br> precoll here is, </p> <pre><code>TYPE precoll IS TABLE of varchar2(8); </code></pre> <p>declared in the package, and procedure below is in package body. Procedure:</p> <pre><code>procedure disp_prereq(p_dept_code IN varchar2, p_courseno IN number, c_prereq OUT SYS_REFCURSOR) IS counter INTEGER ; preserved INTEGER ; prelist precoll := precoll(); row prerequisites%ROWTYPE; BEGIN counter := 1; preserved := 1; cursor cr is select * from prerequisites where dept_code = p_dept_code and course# = p_courseno; open cr; loop fetch cr into row; exit when row%notfound; prelist(counter) := (row.pre_dept_code || row.pre_course#) ; counter := counter + 1; end loop; close cr; preserved := prelist.count; preserved := preserved + 1; counter := 1; cursor indr is select * from prerequisites; open indr; loop fetch indr into row; exit when row%notfound; if (prelist(counter) = (m.dept_code||m.course#)) then prelist(preserved) := m.pre_dept_code||m.pre_course# ; preserved := preserved + 1; end if; counter := counter + 1; end loop; close indr; open c_prereq FOR select * from prelist; END disp_prereq; </code></pre> <p>and show error gave me: <pre><code> 62/9 PLS-00103: Encountered the symbol "CR" when expecting one of the following: := . ( @ % ; </pre></code> And my second question, prelist is a variable of precoll (TYPE precoll IS TABLE of varchar2(8);) Can I query TYPE precoll by a select query, because it is a table of varchar?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload