Hi,

Oups...! Forget my post!
Thanks!

I replace
WHERE(SELECT count(*) FROM room
       WHERE room.roomId BETWEEN OLD.roomIdMin AND OLD.roomIdMax)!= 0;

by
WHERE(EXISTS(SELECT * FROM room WHERE room.roomId BETWEEN OLD.roomIdMin AND
OLD.roomIdMax));

I don't know what is better in term of performance?

Sylvain

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Simon Davies
Sent: Friday, January 22, 2010 11:17 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Problem to trigger a FAIL on DELETE

2010/1/22 Tiberio, Sylvain <[email protected]>:
> Hi,
>
> Here is my database:
>
.
.
.
> CREATE TRIGGER range_del BEFORE DELETE ON range FOR EACH ROW
>  BEGIN
>    SELECT RAISE(FAIL,'Room exist in this range')
>    WHERE (SELECT count(*)
>             FROM room
>             WHERE room.roomId BETWEEN OLD.roomIdMin AND 
> OLD.roomIdMax)= 0;
>  END;

Try
"WHERE room.roomId BETWEEN OLD.roomIdMin AND OLD.roomIdMax)!= 0;"

Regards,
Simon
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to