Home > database >  Mysql error create a trigger, but for a long time do not know to find where is wrong
Mysql error create a trigger, but for a long time do not know to find where is wrong

Time:09-30

The diagram below:

Big help see errors, please? How do the, first thanked bosses,

CodePudding user response:

Why have a semicolon WHERE the front?

CodePudding user response:

Bosses, I try to remove the semicolon is not


You will see

CodePudding user response:

Well, you won't be clauses? End of each statement;
That is to say, the UPDATE and END in front of the semicolon keep
In addition, if you are using mysql client, so the front to a
Delimiter $$
The final END to add $$
And then the back the line
Delimiter.
One more thing, you this is the correct SQL server? A trigger in mysql, not inserted the logical table

CodePudding user response:

 create table if not exists putin (
` stock number ` varchar (10),
` quantity in ` int
);
The create table if not exists warehouse (
` stock number ` varchar (10),
, inventory quantity, int
);

Create the trigger if not exists tput
After the update on putin for each row
The BEGIN
Select @ no:=` stock number `, @ : CNT=` quantity in ` from NEW;
The UPDATE warehouse set, inventory quantity,=, inventory number, + @ CNT where ` stock number `=@ no;
end;


This can

CodePudding user response:

 create table if not exists putin (
` stock number ` varchar (10),
` quantity in ` int
);
The create table if not exists warehouse (
` stock number ` varchar (10),
, inventory quantity, int
);

Create the trigger if not exists tput
After the update on putin for each row
The BEGIN
Select @ no:=` stock number `, @ : CNT=` quantity in ` from NEW;
The UPDATE warehouse set ` inventory quantity `=` inventory quantity ` + @ CNT where ` stock number `=@ no;
end;
  • Related