My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 112 attachment: trigger.txt (442 bytes)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

DELIMITER $$
DROP TRIGGER IF EXISTS stock_check $$
CREATE TRIGGER stock_check
BEFORE UPDATE ON items FOR EACH ROW
BEGIN
IF NEW.quantity < 0 THEN
-- Try to use SET SESSION on a global variable, it will give an error.
SET SESSION sql_notes = 'Negative item quantity not allowed.';
END IF;
END $$
DELIMITER ;


Raises:
Error: 1231 SQLSTATE: 42000 (ER_WRONG_VALUE_FOR_VAR)
Message: Variable '%s' can't be set to the value of '%s'

Powered by Google Project Hosting