AFTER DELETE OR UPDATE OF deptno ON dept
FOR EACH ROW
BEGIN
IF UPDATING THEN
UPDATE emp SET deptno=:new.deptno,
update_id=integritypackage.updateseq
WHERE emp.deptno=:old.deptno AND update_id IS NULL
END IF
IF DELETING THEN
DELETE FROM emp
WHERE emp.deptno=:old.deptno
END IF
END
-----------------------------------------------------------------------------------
CREATE OR REPLACE TRIGGER tr_emp
AFTER UPDATE OF employeeid
ON a
FOR EACH ROW
DECLARE v_count NUMBER
BEGIN
SELECT COUNT(*) INTO v_count
FROM a WHERE employeeid =: new.employeeid
IF v_count = 0 THEN
INSERT INTO b(employeeid)
VALUES(:new.employeeid)
ELSE
UPDATE b SET employeeid =: new.employeeid
WHERE a.XX=b.XX
END IF
END
你参考这两个存储过程,就能解决了。。。不懂再问吧
请采用以下sql语句
select [姓名],[收入] from [用户收入表] where [收入] in(
select max([收入]) from [用户收入表] where [部门]='财务部'
) and [部门]='财务部'
请采纳,有疑问,及时沟通,谢谢!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)