IBM Informix Dynamic Server Version 11.50.FC6
IBM Informix Dynamic Server版本11.50.FC6
I am trying to execute a simple stored procedure from within an update trigger. Together, they are used to update a field with the current timestamp when another field in the same row is updated.
我试图从更新触发器中执行一个简单的存储过程。它们一起用于在更新同一行中的另一个字段时使用当前时间戳更新字段。
Table sp_test
:
id (serial int, unique, not null, primary key)
stat (char(1), not null, default="A")
add_date (date, not null, default today)
upd_date (date, null)
The stored procedure code is:
存储过程代码是:
create procedure upd_row_date_proc (cid int)
update sproc_trig_rec set upd_date = current where id = cid;
end procedure;
This executes fine and creates the routine, but the trigger I am trying to implement on updates is not working.
这执行正常并创建例程,但我尝试在更新上实现的触发器不起作用。
The trigger code is:
触发器代码是:
create trigger upd_row_date_trig
update of stat on sproc_trig_rec
after (execute procedure upd_row_date_proc(id));
I've tried a bunch of syntax variations, but cannot get it to work.
我尝试了一堆语法变体,但无法使其工作。
I usually get my error on the (
char of the 3rd line. Here's the error code:
我经常得到我的错误(第3行的字符。这是错误代码:
201: A syntax error has occurred.
Error in line 3
Near character position 0
Does anyone know what I'm doing wrong in the syntax of the trigger? Could this type of updating be defined in the creation of the table, or do I need to accomplish it by doing it the way described above?
有没有人知道我在触发器的语法中做错了什么?这种类型的更新是否可以在表的创建中定义,或者我是否需要通过上述方式完成它?
Thanks for any help
谢谢你的帮助
1 个解决方案
#1
2
This finally worked for me
这最终对我有用
create trigger ken_trig
update of stat on sproc_trig_rec
referencing old as ken_pre_upd
for each row (execute procedure ken_proc(ken_pre_upd.id));
#1
2
This finally worked for me
这最终对我有用
create trigger ken_trig
update of stat on sproc_trig_rec
referencing old as ken_pre_upd
for each row (execute procedure ken_proc(ken_pre_upd.id));