我写了一触发器如下
create or replace trigger pre_money_change
after insert or update of yx_mk on ydyy.pre_money
for each row
declare
countnum number;
begin
if inserting then
select count(account_id) into countnum from ydyy.pre_money_01 where account_id=:new.account_Id;
if countnum==0 then
insert into ydyy.pre_money_01 values(:new.account_Id,:new.remain_je);
else
update ydyy.pre_money_01 set remain_je=:new.remain_je where account_id=:new.account_id;
end if;
else
update pre_money_01 set remain_je=(SELECT nvl(remain_je/100,0) from ydyy.pre_money where yc_srl=(select max(yc_srl) from ydyy.pre_money where account_id=:new.account_id));
end if;
end;提示错误
PLS-00103: 遇到符号 "=" 当等待下列其中之一时 :
( - + all mod null
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> <a number> <a single-quoted SQL string> any
avg count max min prior some sql stddev sum variance请帮忙解决
谢谢
create or replace trigger pre_money_change
after insert or update of yx_mk on ydyy.pre_money
for each row
declare
countnum number;
begin
if inserting then
select count(account_id) into countnum from ydyy.pre_money_01 where account_id=:new.account_Id;
if countnum==0 then
insert into ydyy.pre_money_01 values(:new.account_Id,:new.remain_je);
else
update ydyy.pre_money_01 set remain_je=:new.remain_je where account_id=:new.account_id;
end if;
else
update pre_money_01 set remain_je=(SELECT nvl(remain_je/100,0) from ydyy.pre_money where yc_srl=(select max(yc_srl) from ydyy.pre_money where account_id=:new.account_id));
end if;
end;提示错误
PLS-00103: 遇到符号 "=" 当等待下列其中之一时 :
( - + all mod null
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> <a number> <a single-quoted SQL string> any
avg count max min prior some sql stddev sum variance请帮忙解决
谢谢
解决方案 »
- SQL语句传入不同数据类型是否能自动转换的配置
- sql优化
- 如何写sql
- ORACLE存储过程中使用变量的问题
- 专家帮下忙啊,我在solaris 9 x86上装ORACLE 8。1。7时出现了错误,安装100%时无法继续下去。界面就死在那里了。
- Oracle客户端如何配置
- 水晶报表 连接 oracle 的问题。??? 先谢谢了。
- 请问各位高手,在相同机子上不同的操作系统里装oracle9i 客户端?
- function 中是否不能用 dbms_sql啊
- 求助,oracle 11g 监听配置的问题
- 重装winnt后,oracle数据库如何恢复
- 如果设置OPTIMIZER_MODE=choose,oracle根据什么来决定是用all_rows还是first_rows来做执行计划?多谢各位指点迷津
after insert or update of yx_mk on ydyy.pre_money
for each row
declare
countnum number;
begin
if inserting then
select count(account_id) into countnum from ydyy.pre_money_01 where account_id=:new.account_Id;
if countnum=0 then
insert into ydyy.pre_money_01(account_Id,remain_je) values(:new.account_Id,:new.remain_je);
else
update ydyy.pre_money_01 set remain_je=:new.remain_je where account_id=:new.account_id;
end if;
else
update pre_money_01 set remain_je=(SELECT nvl(remain_je/100,0) from ydyy.pre_money where yc_srl=(select max(yc_srl) from ydyy.pre_money where account_id=:new.account_id));
end if;
end;
就ok了!
SQL> create or replace trigger pre_money_change
2 after insert or update of yx_mk on test.pre_money
3 for each row
4 declare
5 countnum number(12);
6 begin
7 if inserting then
8 select count(account_id) into countnum from test.pre_money_01 where account_id=:new.account_Id; 9 if countnum=0 then
10 insert into test.pre_money_01(account_id,remain_je) values(:new.account_Id,:new.remain_je);
11 else
12 update test.pre_money_01 set remain_je=:new.remain_je where account_id=:new.account_id;
13 end if;
14 else
15 update pre_money_01 set remain_je=(SELECT nvl(remain_je/100,0) from test.pre_money where yc_srl
=(select max(yc_srl) from test.pre_money where account_id=:new.account_id));
16 end if;
17 end;
18 /Trigger created.