提示什么错误?可以把代码贴出来,让大家帮你分析一下吗?:)
----------------------------------------------------------------------------
最简单的触发器.
create or replace trigger tri_test
after insert on tabtest
for each row
declare
-- local variables here
begin
dbms_output.put_line('test');
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('test');
end tri_test;
----------------------------------------------------------------------------
最简单的触发器.
create or replace trigger tri_test
after insert on tabtest
for each row
declare
-- local variables here
begin
dbms_output.put_line('test');
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('test');
end tri_test;
例如:
create or replace procedure aa
(retvalue char
begin
update bb set cc ='1' where dd = '1';
commit;
retvalue := 'T';
exception
when others then
begin
retvalue := 'F';
rollback;
end;
end;这个过程中成功更新后返回'T',否则返回'F'但在测试时发现,无论更新成功与否,都返回‘T’,说明未触发异常。update的异常如何捕获?
begin
update test set a ='1' where a = '1';
if sql%rowcount = 0 then
retvalue := 'F';
else
commit;
retvalue := 'T';
end if;
end test1;试试这个,参考资料:
An UPDATE statement might update one or more rows or no rows. If one or more rows are updated, you get the following results: SQL%NOTFOUND yields FALSE SQL%FOUND yields TRUE SQL%ROWCOUNT yields the number of rows updated If no rows are updated, you get these results: SQL%NOTFOUND yields TRUE SQL%FOUND yields FALSE SQL%ROWCOUNT yields 0