Home > Net >  MySql trigger problems hope to get help. Thanks
MySql trigger problems hope to get help. Thanks

Time:09-16

Database sheshi
The table name items

I want to pass the trigger to the prohibited items list PCID this field is modified

Could you tell me how to write ah I really should be no

Beg god for help

CodePudding user response:

don't sink

CodePudding user response:

Only have these points

CodePudding user response:

DELIMITER $$

The CREATE
The TRIGGER ` t_item_update ` BEFORE UPDATE ON ` items `
FOR EACH ROW
The BEGIN
IF new. PCID & lt;> Old. PCID THEN
SIGNAL SQLSTATE 'HY000 SET MESSAGE_TEXT=' PCID is not allowed to modify;
END IF;
END;
$$

DELIMITER ;

CodePudding user response:

The
reference 3 floor zijiang001 response:
DELIMITER $$

The CREATE
The TRIGGER ` t_item_update ` BEFORE UPDATE ON ` items `
FOR EACH ROW
The BEGIN
IF new. PCID & lt;> Old. PCID THEN
SIGNAL SQLSTATE 'HY000 SET MESSAGE_TEXT=' PCID is not allowed to modify;
END IF;
END;
$$

DELIMITER ;

Mistakes in grammar errors like mysql version

CodePudding user response:

references to 4th floor don't lower the head to the crown would reply:
Quote: reference zijiang001 reply: 3/f

DELIMITER $$

The CREATE
The TRIGGER ` t_item_update ` BEFORE UPDATE ON ` items `
FOR EACH ROW
The BEGIN
IF new. PCID & lt;> Old. PCID THEN
SIGNAL SQLSTATE 'HY000 SET MESSAGE_TEXT=' PCID is not allowed to modify;
END IF;
END;
$$

DELIMITER ;

Errors like mysql version syntax error


This is support mysql5.5 above

Check the version

CodePudding user response:

I am a MySql version 5.6 is

CodePudding user response:

Query failed: "CREATE TRIGGER ` noupdate ` AFTER the UPDATE ON ` items ` FOR EACH ROW DELIMITER $$CREATE TRIGGER ` t_item_update ` BEFORE UPDATE ON ` items ` FOR EACH ROW the BEGIN. IF the new PCID & lt;> Old. PCID THEN END IF; END; $$DELIMITER;"

MySQL return: # 1064 - You have an error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near '$$CREATE TRIGGER ` t_item_update ` BEFORE UPDATE ON ` items ` for EACH' at line 1

CodePudding user response:

  •  Tags:  
  • C#
  • Related