ERROR at line 19: PLS-00103: Encountered the symbol "¿"

61 Views Asked by At

This procedure is getting following error.

create or replace procedure shedule(grad IN varchar2) as
    cursor cur(grad varchar2) is 
        select s.departments dep, s.groups gr, dis.disc_name diname, t.teach_fio teacher, s.type, s.exam_date,s.exam_time, s.kabinet
        from sessions10 s, disciplines10 dis, teachers10 t
        where dis.disc_id = s.disc_id and t.teach_id = s.teach_id 
        order by s.groups
    schrow cur%ROWTYPE;
        departments varchar2(15);
        groups      number(10);
        disciplines varchar2(15);
begin 
    DBMS_OUTPUT.enable;
    for schrow in cur(grad) LOOP
        departments := schrow.dep;
        groups := schrow.gr;
        disciplines := schrow.diname;
        dbms_output.put_line(departments||' '||groups||' '||disciplines||' '||schrow.teacher||);
    end LOOP;
end;​

gives:

ERROR at line 19: PLS-00103: Encountered the symbol "¿" 
1. create or replace procedure shedule(grad IN varchar2) as
2.     cursor cur(grad varchar2) is 
3.         select s.departments dep, s.groups gr, dis.disc_name diname, t.teach_fio teacher, s.type, s.exam_date,s.exam_time, s.kabinet

Can any one say what is wrong in this?

Thanks.

Create procedure in sql.

2

There are 2 best solutions below

1
Littlefoot On

Two obvious errors:

  • missing semi-colon in line #6
  • superfluous || at the end of line #17

When fixed:

create or replace procedure shedule(grad IN varchar2) as
    cursor cur(grad varchar2) is 
        select s.departments dep, s.groups gr, dis.disc_name diname, t.teach_fio teacher, s.type, s.exam_date,s.exam_time, s.kabinet
        from sessions10 s, disciplines10 dis, teachers10 t
        where dis.disc_id = s.disc_id and t.teach_id = s.teach_id 
        order by s.groups; --> missing semi-colon
        schrow cur%ROWTYPE;
        departments varchar2(15);
        groups      number(10);
        disciplines varchar2(15);
begin 
    DBMS_OUTPUT.enable;
    for schrow in cur(grad) LOOP
        departments := schrow.dep;
        groups := schrow.gr;
        disciplines := schrow.diname;
        dbms_output.put_line(departments||' '||groups||' '||disciplines||' '||schrow.teacher);  --> superfluous ending ||
    end LOOP;
end;​

Though, you reported

Encountered the symbol "¿"

Is there any garbage in that code? Try to delete everything that follows line #17 and type it from scratch.

0
d r On

There is a ZWSP character as last one in row 19. enter image description here

Delete the row 19 and type End; with nothing else and make sure you made the corections stated in Littlefoot's answer. Do not cpoy-paste row 19 from his answer for the same is present there. You can copy first 18 rows, though, and add the 19th yourself.