不好意思,是一个表,insert语句应该如下:
insert into reportdata(datarow,jobid,templateid,itemno,bureau,paravalue,value)   
select 1 x,2 y,3 z ,4 a,5 b,'1' v ,'2' f from dual;

解决方案 »

  1.   

    for each row触发器,不能对触发的表进行操作
    使用包或者临时表来解决。
      

  2.   

    把简单问题复杂化:
    create or replace trigger xx
    before insert on reportdata
    for each row
    declare 
    existitemno reportdata.itemno%TYPE;
     
    exp_error EXCEPTION;
    PRAGMA EXCEPTION_INIT(exp_error, -100);
    begin
    :new.datarow := nvl(:new.itemno,0)+1;

    exception
    when others then
    RAISE exp_error;               
    end;
      

  3.   

    多谢各位,再问一句,
    select a1   from reportdata where a2 = 2;
    如果没有语句被选中,此时希望a1的值为0,应该怎么做呢?有什么比较好的办法?
      

  4.   

    select nvl(max(a1),0) from reportdata where a2 = 2;