Search code examples
sqloracle-databaseplsqlprocedure

This is a procedure to update multiple table's data in oracle , as compiler is showing Error: ORA-00922: missing or invalid option error


This is a procedure to update multiple table's data in oracle , do not know where i am getting wrong as compiler is showing Error: ORA-00922: missing or invalid option error please help

I have checked the syntax I think it is correct .

create or replace procedure add_Course(
  p_title_name in  course.tilte%type,
  p_course_id  in  course.course_id%type,
  p_credits    in  course.credits%type,
  p_program_id in  PROGRAMS.program_id%type,
  p_grade      in  PROGRAMS.grade%type,
  p_room_type  in  classroom.room_type%type,
  p_room_no    in  classroom.room_no%type,
  p_sec_id     in  section.sec_id%type,
  p_semester   in  section.semester%type,
  p_year       in  section.year%type,
  p_building   in section.building%type)
as 
  cnt number;
begin
  select count(*) into cnt from course where title=p_title_name;
  if cnt = 1 then
    update course set credits=p_credits where title=p_title_name;
    update program set program_id=p_program_id,semester=p_semester,year=p_year,grade=p_grade where course_id=p_course_id;
    update classroom set room_type=p_room_tpe, room_no=p_room_no, building=p_building where COURSE_TYPE=p_course_type;
    update section set sec_id=p_sec_id, semester=p_semestr, year=p_year,BUILDING=p_building,room_type=p_room_type where course_id=p_couse_id;
    dbms_output.put_line('course detils is changed');
    commit;

  else 
    dbms_output.put_line('couser dose not exist');

  end if;
end;

Solution

  • There was some syntax error ,

    There are several typos in your code: p_semestr, p_couse_id, p_room_tpe. Certainly your code won't compile until you correct those to be the actual parameter names