如一个表,结构如下:
F1(char)      编号
F2(number)    总数
F3(number)    使用数
F4(number)    剩余数
F5(number)   使用次数我需要每插入一条新记录后,按编号把剩余数和使用次数更新,是按编号更新。001     1000     100    0    0          新插入的一条新记录
001     1000     100  900    1          更新
001     1000     200    0    0          新插入的一条新记录
001     1000     200  700    2          更新
002      800     150    0    0          新插入的一条新记录
002      800     150   650   1          更新不知道说明白没有?

解决方案 »

  1.   

    分兩個Table做吧,一個存總數,一個存使用記錄.
      

  2.   

    分兩個Table做吧,一個存總數,一個存使用記錄.
      

  3.   

    分兩個Table做吧,一個存總數,一個存使用記錄.
      

  4.   

    update your_table set
    F3 = F3 + v_addValue,
    F4 = F2 - F3 - v_addValue,
    F5 = F5 + 1
    where F1 = v_F1;
    所有的值都要初始化的
      

  5.   

    用触发器写啊
    create target tt after insert of your_table
    update your_table set f3=:new.f3,f4=:new.f4,f5=f5+1
    where your_table.f1=:new.f1