create or replace trigger auth_secure
before insert or update or delete --/对整表更新前触发
on g002
begin
IF to_char(sysdate,'DY','nls_date_language=american')
in ('THU') then
Raise_application_error(-20001, 'ou dont have access to modify this table.');
End if;
End ;编译后错误提示为:
5 pls-00103:出现符号""在需要下列之一时:begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifiter>...
8 pls-00103:出现符号""在需要下列之一时:begin case declare else elseif end exit for goto if loop mod null pragma raise return select update while with <an identifiter>...
before insert or update or delete --/对整表更新前触发
on g002
begin
IF to_char(sysdate,'DY','nls_date_language=american')
in ('THU') then
Raise_application_error(-20001, 'ou dont have access to modify this table.');
End if;
End ;编译后错误提示为:
5 pls-00103:出现符号""在需要下列之一时:begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifiter>...
8 pls-00103:出现符号""在需要下列之一时:begin case declare else elseif end exit for goto if loop mod null pragma raise return select update while with <an identifiter>...
before insert or update or delete --/对整表更新前触发
on a
begin
if(to_char(sysdate,'DY','nls_date_language=american') = 'THU') then
Raise_application_error(-20001, 'ou dont have access to modify this table.');
End if;
End ;
这样可以
before insert or update or delete --/对整表更新前触发
on g002--dept
begin
dbms_output.put_line('');
if to_char(sysdate,'DY','nls_date_language=american')
in ('THU') then
Raise_application_error(-20001, 'ou dont have access to modify this table.');
end if;
End ;我试了下,没有问题啊,ok啊!
--触发器好像没有问题,可能又非法字符
create or replace trigger auth_secure
before insert or update or delete --/对整表更新前触发
on g002
begin
IF to_char(sysdate,'DY','nls_date_language=american')
in ('THU') then --前面可能有非法字符
Raise_application_error(-20001, 'ou dont have access to modify this table.');
End if; --前面可能有非法字符
End ;
create or replace trigger auth_secure
before insert or update or delete --/对整表更新前触发
on g002
begin
IF to_char(sysdate,'DY','nls_date_language=american') --前面可能是全角的空格 in ('THU') then
Raise_application_error(-20001, 'ou dont have access to modify this table.');
End if; --前面可能是全角的空格
End ;
有两个不可见的控制符(看似空格,其实编码为A1,十进制161),这是导致编译错误的原因
同样语句End if; 前面也有两个。
删除后应该编译OK
不知楼主在什么地方复制的