473,503 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exceptions in Triggers MYSQL 5.0

1 New Member
Hi,

Someone knows about. How can i create exceptions or display messages in triggers, as the commands "raiserror" and "Print" in sqlserver ?

Thanks,

Olimpio.
Aug 22 '06 #1
1 2933
masdi2t
37 New Member
u can create exception's like behaviour with handler but i do not understand how to display message.

this one from MySQL documentation
Expand|Select|Wrap|Line Numbers
  1. DECLARE handler_type HANDLER FOR condition_value[,...] statement
  2.  
  3. handler_type:
  4.     CONTINUE
  5.   | EXIT
  6.   | UNDO
  7.  
  8. condition_value:
  9.     SQLSTATE [VALUE] sqlstate_value
  10.   | condition_name
  11.   | SQLWARNING
  12.   | NOT FOUND
  13.   | SQLEXCEPTION
  14.   | mysql_error_code
  15.  
also from MySQL documentation
Expand|Select|Wrap|Line Numbers
  1. mysql> CREATE TABLE test.t (s1 int,primary key (s1));
  2. Query OK, 0 rows affected (0.00 sec)
  3.  
  4. mysql> delimiter //
  5.  
  6. mysql> CREATE PROCEDURE handlerdemo ()
  7.     -> BEGIN
  8.     ->   DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
  9.     ->   SET @x = 1;
  10.     ->   INSERT INTO test.t VALUES (1);
  11.     ->   SET @x = 2;
  12.     ->   INSERT INTO test.t VALUES (1);
  13.     ->   SET @x = 3;
  14.     -> END;
  15.     -> //
  16. Query OK, 0 rows affected (0.00 sec)
  17.  
Aug 23 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

33
2959
by: Steven Bethard | last post by:
I feel like this has probably been answered before, but I couldn't find something quite like it in the archives. Feel free to point me somewhere if you know where this has already been answered. ...
2
1761
by: Paul Reddin | last post by:
Hi, I've implemented calling a SP form a trigger using the CALL_PROCEDURE() UDF from http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0402greenstein/ A couple of questions...
10
1279
by: Razzie | last post by:
Hi all, The title of this post may sound a bit weird, but I was wondering about the following nonetheless. I have a class libray containing, say, 4 classes: A, B, C, D. Class A somehow has a...
7
6088
by: JJ | last post by:
How do I set one field to have the updated timestamp, and another to have the created timestamp? I want to do this directly from code generated from DB Designer if possible?! JJ
1
4823
by: krunalb | last post by:
Hi, As I understand STL are bound to throw an exception on occurrence of invalid condition. Is there a way in which I can use -fno-exceptions with STL. (Something similar to new(nothrow) ...
2
1283
by: maheshmurali | last post by:
Can Mysql Support VIew, Triggers, Cursors? If possible, Do all versions of Mysql support the above?
2
1111
by: paulq182 | last post by:
hello, im new to mysql and was looking to know what triggers are? cheers!!!
0
1710
by: imran haq | last post by:
Hi All, I have 3 rather Long Questions that are causing alot of trouble: I would appreciate all the help i can get and tried to use A post sent to atli in the past but it did not help... !) I...
4
5692
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
7192
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.