PL SQL触发器使用raise_application_error引发错误. [英] PL SQL trigger using raise_application_error thows error.
问题描述
我有一些代码需要调试帮助,但我认为,如果我可以运行其中的一部分,我将可以得到其余的代码(哦,我希望如此).
I have a few things of code I need help debugging but I feel that if I can get one of them running i'll be able to get the rest(oh how i hope).
create or replace
trigger minimumwage
before insert or update on Employee
for each row
begin
if :new.Wage < 7.25
then raise_application_error('-20000,Pay is below Texas minimum wage!');
end if;
end;
/
我正在尝试通过sqlplus在我学校的服务器上运行的表上执行此操作,如果有帮助的话.
I'm trying to do this on a table ran on my school's server through sqlplus if that helps.
推荐答案
遇到错误时,指定什么错误总是有帮助的.触发器中的raise_application_error
调用中存在语法错误.该过程需要两个参数,一个数字和一个字符串.您传入的是一个长字符串的单个参数.
When you're getting an error, it's always helpful to specify what error. There is a syntax error in the raise_application_error
call in your trigger. That procedure takes two arguments, a number and a string. You are passing in a single argument that is one long string.
create or replace trigger minimumwage
before insert or update on Employee
for each row
begin
if :new.Wage < 7.25
then
raise_application_error(-20000,'Pay is below Texas minimum wage!');
end if;
end;
假设EMPLOYEE
表中有WAGE
列,则
应该是有效的.
should be valid assuming there is a WAGE
column in your EMPLOYEE
table.
这篇关于PL SQL触发器使用raise_application_error引发错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!