目标表不可更新(更新视图)

时间:2016-12-11 13:18:05

标签: mysql

你好我想用这个程序更新一个视图,但我收到以下错误: 程序:

    CREATE DEFINER=`root`@`localhost` PROCEDURE `setijfchauffeur`()
    begin

   declare cnt int;
 declare c int;
 declare cn int;
 declare nomvol varchar(11);
 declare i int;
 declare rest int;
 /*create a table with ID and ARR_num*/
create table ijfnbrvols select distinct ARR_num from ijforder ;
 alter table ijfnbrvols add column ID int primary key auto_increment after       ARR_num;

   select count(*) into cnt from ijfnbrvols ;
   set c = 1;

    while (c<= cnt) do 
     select ARR_num into nomvol from ijfnbrvols where ID = c;
     select count(*) into cn from ijforder where ARR_num = nomvol;
     if (cn <= 3) and (cnt !=0) THEN

   update ijforder set Chauffeur ='berline' where ARR_num = nomvol;

  END IF;

  if (cnt <= 8) and (cnt >=4) THEN

  update ijforder set Chauffeur ='minibus' where ARR_num = nomvol;

   END IF;
  set c= c+1;
   End while;
   END

我收到此错误:错误代码:1288。UPDATE的目标表ijforder不可更新

请帮助:)谢谢

0 个答案:

没有答案