SOS mysql signal syntax error

SOS mysql signal syntax error

am 20.05.2009 19:58:27 von Alex Katebi

Hi Folks,

I am getting syntax error with the mysql signal. I have a trigger
that needs a signal for raising an error condition if a row with
specific value is removed.

CREATE TRIGGER my_trig BEFORE DELETE ON my_tbl
FOR EACH ROW BEGIN
DECLARE mysig CONDITION FOR SQLSTATE '45000';
IF OLD.name = 'base' THEN
SIGNAL mysig SET MESSAGE_TEXT='base row removal is not allowed';
END IF;
END

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

RE: SOS mysql signal syntax error

am 20.05.2009 20:22:30 von Gavin Towey

Interesting. This syntax is only supposed to be available as of 5.4, but i=
t doesn't even work there. The reference I found was at :
http://dev.mysql.com/tech-resources/articles/mysql-54.html

But I couldn't find other references to the new signal support.

This is listed as the example on that page, but it doesn't work in 5.4.0-be=
ta

CREATE PROCEDURE p (divisor INT)
BEGIN
DECLARE divide_by_zero CONDITION FOR SQLSTATE '22012';
IF divisor =3D 0 THEN
SIGNAL divide_by_zero;
END IF;
END

Methinks someone forgot to include this feature in the release!


-----Original Message-----
From: Alex Katebi [mailto:alex.katebi@gmail.com]
Sent: Wednesday, May 20, 2009 10:58 AM
To: mysql
Subject: SOS mysql signal syntax error

Hi Folks,

I am getting syntax error with the mysql signal. I have a trigger
that needs a signal for raising an error condition if a row with
specific value is removed.

CREATE TRIGGER my_trig BEFORE DELETE ON my_tbl
FOR EACH ROW BEGIN
DECLARE mysig CONDITION FOR SQLSTATE '45000';
IF OLD.name =3D 'base' THEN
SIGNAL mysig SET MESSAGE_TEXT=3D'base row removal is not allowed';
END IF;
END

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgtowey@ffn.com


The information contained in this transmission may contain privileged and c=
onfidential information. It is intended only for the use of the person(s) n=
amed above. If you are not the intended recipient, you are hereby notified =
that any review, dissemination, distribution or duplication of this communi=
cation is strictly prohibited. If you are not the intended recipient, pleas=
e contact the sender by reply email and destroy all copies of the original =
message.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: SOS mysql signal syntax error

am 20.05.2009 21:28:02 von Alex Katebi

--0016e6464f6ca69354046a5d0608
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

OK I tried this exact syntax and I get the same error. I tried it on mysql
client for 6.0.10

On Wed, May 20, 2009 at 2:22 PM, Gavin Towey wrote:

> Interesting. This syntax is only supposed to be available as of 5.4, but
> it doesn't even work there. The reference I found was at :
> http://dev.mysql.com/tech-resources/articles/mysql-54.html
>
> But I couldn't find other references to the new signal support.
>
> This is listed as the example on that page, but it doesn't work in
> 5.4.0-beta
>
> CREATE PROCEDURE p (divisor INT)
> BEGIN
> DECLARE divide_by_zero CONDITION FOR SQLSTATE '22012';
> IF divisor = 0 THEN
> SIGNAL divide_by_zero;
> END IF;
> END
>
> Methinks someone forgot to include this feature in the release!
>
>
> -----Original Message-----
> From: Alex Katebi [mailto:alex.katebi@gmail.com]
> Sent: Wednesday, May 20, 2009 10:58 AM
> To: mysql
> Subject: SOS mysql signal syntax error
>
> Hi Folks,
>
> I am getting syntax error with the mysql signal. I have a trigger
> that needs a signal for raising an error condition if a row with
> specific value is removed.
>
> CREATE TRIGGER my_trig BEFORE DELETE ON my_tbl
> FOR EACH ROW BEGIN
> DECLARE mysig CONDITION FOR SQLSTATE '45000';
> IF OLD.name = 'base' THEN
> SIGNAL mysig SET MESSAGE_TEXT='base row removal is not allowed';
> END IF;
> END
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=gtowey@ffn.com
>
>
> The information contained in this transmission may contain privileged and
> confidential information. It is intended only for the use of the person(s)
> named above. If you are not the intended recipient, you are hereby notified
> that any review, dissemination, distribution or duplication of this
> communication is strictly prohibited. If you are not the intended recipient,
> please contact the sender by reply email and destroy all copies of the
> original message.
>

--0016e6464f6ca69354046a5d0608--