try:
drop table A;
drop table B;
create table A(a1 number(3),a2 number(3));
create table B(a1 number(3),a2 number(3));CREATE OR REPLACE TRIGGER UnionData AFTER
INSERT OR UPDATE OR DELETE ON A
for each row
BEGIN
if updating then
update b set a1=:new.a1,a2=:new.a2 where a1=:old.a1;
elsif inserting then
insert into b (select a1,a2 from a where a1=:new.a1);
else
delete from b where b.a1=:old.a1;
end if;
END;
drop table A;
drop table B;
create table A(a1 number(3),a2 number(3));
create table B(a1 number(3),a2 number(3));CREATE OR REPLACE TRIGGER UnionData AFTER
INSERT OR UPDATE OR DELETE ON A
for each row
BEGIN
if updating then
update b set a1=:new.a1,a2=:new.a2 where a1=:old.a1;
elsif inserting then
insert into b (select a1,a2 from a where a1=:new.a1);
else
delete from b where b.a1=:old.a1;
end if;
END;
解决方案 »
- 请教 BOM SQL展开问题
- 如果归档日志已经从ARCHIVELOG目录拷贝到其他目录(硬盘),如果做恢复?
- 使用C连接ORACLE
- 请教高人给写个oralce查询语句.
- 还有人吗?急死了。很简单的问题。
- 请问在oracle 9 中 如何修改数据库的缓存区大小
- oracle7的数据导入oracle816不能导入吗?
- BLOB字段的数据删除时要另外处理吗?(在线)
- 请给个简单的实现SELECT * FROM ABC 的例子谢谢
- 过程中,怎么取得系统当前的时间,进一不得到年,月,日,请指点,谢谢!
- What's wrong anout this procedure?
- EXECUTE IMMEDIATE 后面的字符串是不是有长度限制?
drop table B;
create table A(a1 number(3),a2 number(3));
create table B(a1 number(3),a2 number(3));CREATE OR REPLACE TRIGGER UnionData AFTER
INSERT OR UPDATE OR DELETE ON A
for each row -- 添加
BEGIN
if updating then
update b set a1=:new.a1,a2=:new.a2 where a1=:old.a1; --修正
elsif inserting then
insert into b values(:new.a1,:new.a2); --修正
else
delete from b where b.a1=:old.a1;
end if;
END;