很久没写存储过程了,报错是
PLS-00103: 出现符号 "INT"在需要下列之一时:
 := . ( @ % ;
符号 ":=" 被替换为 "INT" 后继续。代码是
create or replace procedure adddata
as
begin
i int;
loop
i:=i+1;
exit when i>100;
insert into t_applyinfo values (10000+i,'deming',11,6,'我来测试,批量测试','1','0101','我来测试,批量测试',sysdate,'','','');
end loop;
commit;
end adddata想要实现插入数据库100条数据,序号从10000开始,每次加1,大家看能不能实现啊

解决方案 »

  1.   

    create or replace procedure adddata as 
    i int;
    begin 
    loop 
    i:=i+1; 
    exit when i>100; 
    insert into t_applyinfo values (10000+i,'deming',11,6,'我来测试,批量测试','1','0101','我来测试,批量测试',sysdate,'','',''); 
    end loop; 
    commit; 
    end adddata 
      

  2.   

    create or replace procedure adddata as
      i int;
    begin
      loop
        i := i + 1;
        exit when i > 100;
        insert into t_applyinfo
        values
          (10000 + i,
           'deming',
           11,
           6,
           '我来测试,批量测试',
           '1',
           '0101',
           '我来测试,批量测试',
           sysdate,
           '',
           '',
           '');
      end loop;
      commit;
    end adddata;
      

  3.   

    不好意思,先前复制错了
    源代码的定义是在begin前面 我用toad执行create or replace procedure adddata 
    as 
    i int; 
    begin 
    loop 
    i:=i+1; 
    exit when i>100; 
    insert into t_applyinfo values (10000+i,'deming',11,6,'我来测试,批量测试','1','0101','我来测试,批量测试',sysdate,'','',''); 
    end loop; 
    commit; 
    end adddata 错误提示是  
    PLS-00103: 出现符号 "INT"在需要下列之一时: 
    := . ( @ % ; 
    符号 ":=" 被替换为 "INT" 后继续。
      

  4.   

     i int;
    --->
    i int:=0;
      

  5.   

    --给个简单的参考例子: create table t(pk number primary key,...); 
    create sequence t_seq; 
    create trigger t_trigger before insert on t for each row 
    begin 
      select t_seq.nextval into :new.pk from dual; 
    end; 
      

  6.   

    改好的版本,你用这个试一下.create or replace
    procedure adddata
    as
    i int;
    begin
    i := 1;
    loop
      exit when i>100;
      insert into t_applyinfo values (10000+i,'deming',11,6,'我来测试,批量测试','1','0101','我来测试,批量测试',sysdate,'','','');
      i := i + 1;
    end loop;
    commit;
    end adddata; 
      

  7.   

    pls应该是过程编译错误,不是运行时错误