--当用充值串号充值时,先插入充值记录,然后触发TUserPoints更新和TAgentSubKey更新
CREATE OR REPLACE FUNCTION addTo_Charge_Record()
 RETURNS trigger  AS
$BODY$
begin --更新充值用户的题分
if(select state from T_Agent_SubKey where ask_chargekey_id= NEW.fk_chargekey_id)='N' then 
update T_User_Points
set user_points = user_points +
(select points 
from T_Agent_SubKey 
where ask_chargekey_id= NEW.fk_chargekey_id),
last_modify = now()
where fk_special_user_id = NEW.fk_charge_user_id;
--更新代理对应的充值串码状态
update T_Agent_SubKey 
set points = 0,state = 'Y'
where ask_chargekey_id = NEW.fk_chargekey_id;
else 
RAISE EXCEPTION '充值卡已使用';
end if;
return null;
end;   
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
 CREATE TRIGGER tg_add_charge_record
  after INSERT
  ON T_Charge_Record
  FOR EACH ROW
  EXECUTE PROCEDURE addTo_Charge_Record();
问题:
1、触发器能将异常返回给触发他的方法吗?
2、如果能,怎样返回。最好能有详细的演示代码
3、如果不能,有没有什么类似的可用办法补救
(在外部用异常捕获暂不考虑,因为这样要做很多判断)
谢谢!