Subject | AW: [firebird-support] Check previous records in the table before table update |
---|---|
Author | Olaf Kluge |
Post date | 2013-06-24T07:32:48Z |
Hello Kukiejko.
You mean that you can only update a dataset with time is not null? First,
you should not use a column-name like "time". In this case you mean ID 233
is possible and ID 234 not? If you use a trigger, you'll never can update
the time-column because it is never possible if the old time-value is null
and the new is not null.
. before update .
If(old.time is null and new.time is not null) then
Begin
New.time = old.time
Exception..
End
Or would you only update the time column for the record with the next ID
after last time-filled-record?
--------
Hello,
I use Firebird 2.5 for Windows.
I need to create UPDATE TRIGGER for Table A, but
UPDATE for the Table A for row ID=x is only possible if TIME column for ID<x
is >not< [null]. For example I can update Time column for row ID=234 but it
should be not possible to update Time column for row ID=235.
How can I do it on the Firebird server (using eg. Trigger, functions or
procedures)?
--------------------------------------------
TABLE A:
ID | TIME
==========================================
229 | 07.06.2013, 18:06:35.871
230 | 07.06.2013, 16:42:52.941
231 | 07.06.2013, 16:42:53.286
233 | 07.06.2013, 16:42:53.607
234 | [null]
235 | [null]
236 | [null]
------------------------------------------
Thank you for any feedback or example
Kukiejko
[Non-text portions of this message have been removed]
You mean that you can only update a dataset with time is not null? First,
you should not use a column-name like "time". In this case you mean ID 233
is possible and ID 234 not? If you use a trigger, you'll never can update
the time-column because it is never possible if the old time-value is null
and the new is not null.
. before update .
If(old.time is null and new.time is not null) then
Begin
New.time = old.time
Exception..
End
Or would you only update the time column for the record with the next ID
after last time-filled-record?
--------
Hello,
I use Firebird 2.5 for Windows.
I need to create UPDATE TRIGGER for Table A, but
UPDATE for the Table A for row ID=x is only possible if TIME column for ID<x
is >not< [null]. For example I can update Time column for row ID=234 but it
should be not possible to update Time column for row ID=235.
How can I do it on the Firebird server (using eg. Trigger, functions or
procedures)?
--------------------------------------------
TABLE A:
ID | TIME
==========================================
229 | 07.06.2013, 18:06:35.871
230 | 07.06.2013, 16:42:52.941
231 | 07.06.2013, 16:42:53.286
233 | 07.06.2013, 16:42:53.607
234 | [null]
235 | [null]
236 | [null]
------------------------------------------
Thank you for any feedback or example
Kukiejko
[Non-text portions of this message have been removed]