我需要编写这样一个触发器来检查人员姓名,如果他们的姓名中有任何数字,将会打印出他/她的ID。检查VARCHAR2是否仅包含使用触发器的字母表
我有现在:
set SERVEROUTPUT ON
create or replace trigger BeforeUpdate
Before insert on customer
for each row
declare
n varchar2(10);
counter number;
nextR number:=0;
begin
select count(id_customer) into counter from customer;
LOOP
nextR:= nextR +1;
select cname into n from customer where id_customer = nextR;
if n not like '%[0-9]%' then
DBMS_OUTPUT.PUT_LINE(nextR || ' has incorrect name');
end if;
exit when nextR = counter;
end loop;
end;
/
它编译,当我试图触发此触发它什么也不做。
我将不胜感激任何帮助。
不幸的是,这是行不通以及 但现在我h我想知道我应该使用什么。 非常感谢 – Yun8483
@ Yun8483,它的确适用于我的示例。好的,继续尝试:-)我所做的调整将捕获像Bat9Man,Bat9Man1等等的东西。 –
@ Yun8483,编辑 –