Oracle中的trigger

Oracle中开发,我想每当输入James时,就会出现一段话('This is a lucky dog'),但总是实现不了。表ct_customer已经建立,下面是我的代码。
CREATE OR REPLACE TRIGGER tag_customer
AFTER INSERT on ct_customer
for each row
Declare
c_lastname Varchar2(30);
Begin
select c_last into c_lastname
from ct_customer
where ct_last='James';
dbms_output.put_line('This is a lucky dog');
commit;
end;
/
INSERT INTO ct_customer(c_id,c_last) VALUES (39, 'James');

你的触发器代码存在一些问题,以下是修改后的代码:
CREATE OR REPLACE TRIGGER tag_customer
AFTER INSERT ON ct_customer
FOR EACH ROW
DECLARE
c_lastname VARCHAR2(30);
BEGIN
SELECT c_last INTO c_lastname
FROM ct_customer
WHERE c_last = 'James';

END;
/
触发器中需要使用IF语句进行条件判断,如果c_lastname等于'James',则输出相应的内容。同时,应该使用c_last而不是ct_last,这是因为在表ct_customer中不存在名为ct_last的列。