我有这些桌子
CELL(CellId, x0, y0, x1, y1, CurrentPhone#, MaxCalls)
TELEPHONE(PhoneNo, x, y, PhoneState)
STATE_CHANGE(ChangeId, TimeStamp, PhoneNo, x, y, ChangeType)
我必须创建这个触发器(触发器是强制性的)
更改最大活动呼叫数:蜂窝电话网络可能会减少与单个小区相关的最大活动呼叫数以管理问题(减少CELL表中的MaxCalls值)。更新单个单元格的MaxCalls属性可能会导致不一致的情况,即CELL表中的MaxCalls值变得小于所考虑单元格中当前活动电话的数量(PhoneState='Active') 。如果是这样,则相应的MaxCalls属性需要使用当前活动电话的数量进行更新(PhoneState='Active')在考虑的单元格中
我写了这个触发器
create or replace trigger CELL_T1
AFTER UPDATE OF MAXCALLS ON CELL
BEGIN
UPDATE CELL E1
SET E1.MAXCALLS=(
SELECT COO
FROM (SELECT E2.CELLID, COO
FROM CELL E2, (
SELECT CELLID, COUNT(*) COO
FROM CELL C2, TELEPHONE
WHERE PhoneState='Active' AND x<x1 AND x>=x0 AND y<y1 AND y>=y0
GROUP BY C2.CellId
)TW
WHERE E2.CELLID=TW.CELLID AND COO>E2.MAXCALLS
)
)
WHERE E1.CELLID IN (
SELECT C1.CELLID
FROM CELL C1, (
SELECT CELLID, COUNT(*) COO
FROM CELL C3, TELEPHONE
WHERE PhoneState='Active' AND x<x1 AND x>=x0 AND y<y1 AND y>=y0
GROUP BY C3.CellId
)TW1
WHERE C1.CELLID=TW1.CELLID AND COO>C1.MAXCALLS and e1.cellid=tw1.cellid
);
END;
触发器编译没有问题;然后我写了更新声明:
UPDATE CELL SET MAXCALLS=MAXCALLS-2;
但我得到了这些错误:
ORA-06512: at "MATTEO.CELL_T1", line 2
ORA-04088: error during execution of trigger 'MATTEO.CELL_T1'
ORA-06512: at "MATTEO.CELL_T1", line 2
ORA-04088: error during execution of trigger 'MATTEO.CELL_T1'
ORA-06512: at "MATTEO.CELL_T1", line 2
ORA-04088: error during execution of trigger 'MATTEO.CELL_T1'
ORA-06512: at "MATTEO.CELL_T1", line 2
ORA-04088: error during execution of trigger 'MATTEO.CELL_T1'
ORA-06512: at "MATTEO.CELL_T1", line 2
ORA-04088: error during execution of trigger 'MATTEO.CELL_T1'
ORA-0
- 更新单元格
- SET MaxCalls = MaxCalls-2;
我在触发器中找不到任何问题;怎么了?