日期:2014-05-17 浏览次数:20977 次
SQL> CREATE TABLE idletest(ID NUMBER);
Table created
SQL> CREATE OR REPLACE TRIGGER idletesttrigger BEFORE INSERT ON idletest
2 DECLARE v NUMBER;
3 BEGIN
4 SELECT COUNT(ID) INTO v FROM idletest;
5 IF v >= 3 THEN
6 RAISE_APPLICATION_ERROR(-20001, 'max is 3');
7 END IF;
8 END;
9 /
Trigger created
SQL>
SQL> INSERT INTO idletest VALUES(1);
1 row inserted
SQL> INSERT INTO idletest VALUES(2);
1 row inserted
SQL> INSERT INTO idletest VALUES(3);
1 row inserted
SQL> INSERT INTO idletest VALUES(4);
INSERT INTO idletest VALUES(4)
ORA-20001: max is 3
ORA-06512: 在 "RCOTRPR1.IDLETESTTRIGGER", line 5
ORA-04088: 触发器 'RCOTRPR1.IDLETESTTRIGGER' 执行过程中出错
SQL>
create or replace function fun_st_course(crno in number, stno in number,stno in number) return integer is
PRAGMA AUTONOMOUS_TRANSACTION;
Result integer;
v_mx number;
v_cur number;
begin
sele