New answers tagged

2 votes

"column new.total does not exist" error while creating a trigger

The Hint in the error message suggests that you have a column of the name "new.total" - containing the reserved word "new", and a dot (!). The otherwise illegal identifier forced ...
user avatar
0 votes

Use variable as column name

I can't let you do this. :) Don't repeatedly UPDATE the triggering row. That's hugely inefficient and error-prone. Use a BEFORE trigger instead, where you can simply assign new values to columns of ...
user avatar
1 vote
Accepted

Understanding `WHERE x = NEW.x` Syntax

This is not actually a DBA question but rather a Boolean algebra question (which means it might be more at home on Stack Overflow.) In short, you want the trigger to fire if EITHER: a_number is ...
user avatar
0 votes

Use default value instead of inserted null

A trigger is the right workaround if your problem can't be fixed. You stated: The problem is that the server produces queries with explicit null values if not given other instructions. I have no way ...
user avatar
-2 votes

Use default value instead of inserted null

create table test_table ( notes varchar, date_created date NOT NULL DEFAULT now(), edited_by varchar NOT NULL DEFAULT "current_user"() ); INSERT INTO test_table (notes) VALUES('test'...
user avatar
  • 1

Top 50 recent answers are included