Going back to the OP's problem - the original issue I believe was he was
using old instead of OLD (case-sensitive) - now that's sorted, MySQL
is complaining about a syntax error toward the end of the function
declaration.
I'm surprised by the case sensitivity of OLD though, it works fine on
On 12/5/08, Lola J. Lee Beno [EMAIL PROTECTED] wrote:
I'm trying to create a trigger (5.0.45) and I've read the documentation at
mysql.com. I keep getting a syntax error, but can't figure out what the
error is. Here's the trigger I'm trying to create:
delimiter //
create trigger
David Giragosian wrote:
I'm no expert, but 'old' is a table, I'm guessing, and it isn't
referenced in the 'from' clause of the query.
could it be that simple...?
David
No . . . 'old' is a virtual table that is the same as the table I'm
doing work on. See
I'm trying to create a trigger (5.0.45) and I've read the documentation
at mysql.com. I keep getting a syntax error, but can't figure out what
the error is. Here's the trigger I'm trying to create:
delimiter //
create trigger jobposts_control
before delete on jobposts for each row
begin
can you not use referential integrity for this - assuming the tables are or
can be made to be innodb?
Does the jobposts table have a jobpost_id field, or is it just id? Maybe
it's a typo?
On Fri, Dec 5, 2008 at 11:28 AM, Lola J. Lee Beno [EMAIL PROTECTED] wrote:
David Giragosian wrote:
Jim Lyons wrote:
can you not use referential integrity for this - assuming the tables are or
can be made to be innodb?
The tables are myISAM. These could be changed to innodb but I want to
see if i can get this trigger work.
Does the jobposts table have a jobpost_id field, or is it just
Martijn Tonies wrote:
What is the exact error message?
Here's the latest query:
delimiter //
create trigger jobposts_control
before delete on jobposts for each row
begin
declare dummy varchar(255);
set @counted = (
select count(ad.adsource_id)
from adsource ad, jobposts
Hi,
What is the exact error message?
Here's the latest query:
delimiter //
create trigger jobposts_control
before delete on jobposts for each row
begin
declare dummy varchar(255);
set @counted = (
select count(ad.adsource_id)
from adsource ad, jobposts jp
where
Martijn Tonies wrote:
Hi,
What is the exact error message?
Here's the latest query:
delimiter //
create trigger jobposts_control
before delete on jobposts for each row
begin
declare dummy varchar(255);
set @counted = (
select count(ad.adsource_id)
from adsource ad,
delimiter //
create trigger jobposts_control
before delete on jobposts for each row
begin
declare dummy varchar(255);
set @counted = (
select count(ad.adsource_id)
from adsource ad, jobposts jp
where ad.adsource_id = jp.adsource_id
and OLD.jobpost_id =
Andy Shellam wrote:
I'm guessing it's the first semi-colon in your IF statement. Does
this work...?
if @counted = 1 then SET dummy = 'Cannot delete this record' end if;
Just a guess!
Andy.
That's not it, unfortunately.
ERROR: You have an error in your SQL syntax; check the manual
ERROR: 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 'if @counted = 1 then SET dummy = 'Cannot
delete this record' end if' at line 1
This works on 5.1.30 and 6.0.7:
create table jobposts(adsource_id
Hi,
What is the exact error message?
Here's the latest query:
delimiter //
create trigger jobposts_control
before delete on jobposts for each row
begin
declare dummy varchar(255);
set @counted = (
select count(ad.adsource_id)
from adsource ad, jobposts jp
where
On Fri, December 5, 2008 12:14, Martijn Tonies wrote:
Hi,
What is the exact error message?
Here's the latest query:
delimiter //
create trigger jobposts_control
before delete on jobposts for each row
begin
declare dummy varchar(255);
set @counted = (
select
I think you are missing the point. Where is 'OLD' or 'old' defined?
Before you try to imbed it in a trigger, try the basic query. That seems
to be what its complaining about.
OLD is a virtual table which is only present in a trigger - it's like a
table with the same layout as the table
15 matches
Mail list logo