为什么触发器不工作? 贴有代码,请各位帮忙.
边城cn 2008-04-16 11:29:28 --功能说明:当宾馆插入数据,或修改宾馆名称时,触发器自动生成宾馆名称的拼音名称.
--但现在此功能不功作,不知是否NEW.HOTEL_NO 这里有问题呢.
create or replace trigger TRG_TEST_HOTEL_PINYIN
after insert or update on TEST_HOTEL for each row
begin
if inserting then
update TEST_HOTEL set n_hotel_pinyin=get_pinyin(:new.hotel_name)
where hotel_no= :new.hotel_no;
commit;
else -- if updating
update TEST_HOTEL set n_hotel_pinyin=get_pinyin(:new.hotel_name)
where hotel_no= :old.hotel_no;
commit;
end if;
exception
when others then
htp.print('error='||SQLERRM);
end;