【发布时间】:2022-02-21 22:32:39
【问题描述】:
declare
cnt number;
begin
select count(*)
into cnt
FROM employee;
IF cnt = 0 THEN
DELETE employee;
COMMIT;
EXCEPTION
WHEN others THEN
log_error_local(k_sub_module, l_step||' '||sqlerrm);
raise;
END IF;
end
出现如下语法错误.. 错误(188,13):PLS-00103:在预期以下情况之一时遇到符号“EXCEPTION”:(begin case declare else elsif end exit for goto if loop mod null pragma raise return select update while with
【问题讨论】:
-
如果有员工,则计算,如果没有员工,则删除所有员工;因为那时您知道没有员工,那么
DELETE似乎毫无意义。你想达到什么目的? -
理想情况下,您的
log_error_local过程将捕获sqlerrm本身,而不是要求开发人员将其连接到每个调用中。