|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I'm not sure is this possible or not.
Suppose I have a Table with these fileds id Name Duration Prefix And the Insert is: Insert (id, name, duration, prefix) values ( 10, test, 30, pr#) I want to check the value of Prefix, If it is tt# then the Duration should change to: duration + 5, Otherwise it is the same. I don't want to change this in the Code Level (PHP, Ruby) which mean I don't want to check it before the Insert Command, I want to know is there a way to do so with MySQL itself at the time of the insert, with Procedures, Constraint check or something else. Thank you in Advance |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Mon, 31 Mar 2008 23:00:02 +0200, <AAFShini@gmail.com> wrote:
> I'm not sure is this possible or not. > Suppose I have a Table with these fileds > > id > Name > Duration > Prefix > > And the Insert is: Insert (id, name, duration, prefix) values ( 10, > test, 30, pr#) > > I want to check the value of Prefix, If it is tt# then the Duration > should change to: duration + 5, Otherwise it is the same. > > I don't want to change this in the Code Level (PHP, Ruby) which mean I > don't want to check it before the Insert Command, I want to know is > there a way to do so with MySQL itself at the time of the insert, with > Procedures, Constraint check or something else. http://dev.mysql.com/doc/refman/5.0/...e-trigger.html -- Rik Wasmus |
|
![]() |
| Outils de la discussion | |
|
|