MySQL Forums
Forum List  »  Triggers

Re: Problem with simple trigger
Posted by: Henrik Bislev
Date: January 17, 2006 12:44PM

Hello Dmitri.

I am running version 5.0.18-nt.

Here are my SQL-script, running through MySQL Query Browser 1.1.18 :

use dafif8;
drop table RWY;
create table RWY
(
ARPT_IDENT CHAR(7) NOT NULL DEFAULT "",
HE_ELEV SMALLINT DEFAULT 0,
KEY (ARPT_IDENT)
);
delimiter //
create trigger RWY_insert before insert on RWY
for each row
begin
if NEW.HE_ELEV = "U" then set NEW.HE_ELEV = null; end if;
end;
//
delimiter ;

When executing the following insert statement

Insert into dafif8.rwy values ('HENRIK','');

I get the error-message "Incorrect integer value: '' for column 'HE_ELEV' at row 1.

As I see it, I am doing exactly what you, and the manual, is telling me to do.

I haven't tried the example, where the IF-statement is integrated in the load-statement, but my project potentially contains 20 or so tables, and will need to be reloaded once a month. I hope that by using the trigger-solution I will have a much simpler load-statement.

Regards Henrik.

Options: ReplyQuote


Subject
Views
Written By
Posted
2696
January 16, 2006 01:55PM
1809
January 16, 2006 05:26PM
Re: Problem with simple trigger
1867
January 17, 2006 12:44PM
1795
January 18, 2006 09:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.