MySQL Forums
Forum List  »  Triggers

Big trigger, small error 1064
Posted by: Frantisek Dobrota
Date: December 13, 2010 06:35AM

I really don't know where I made the mistake, I think code this should work:

DELIMITER |
CREATE TRIGGER `parOSOnInsert` BEFORE INSERT
ON `Partition_has_Operating_System` FOR EACH ROW
BEGIN
    IF ((NEW.`Operating_System_id_OS` IN SELECT `Operating_System_id_OS` FROM
        `CompanyPCs`.`Operating_System_has_Kernel` JOIN `CompanyPCs`.`Kernel` JOIN
        `CompanyPCs`.`Kernel_supports_Filesystem` JOIN `CompanyPCs`.`Filesystem` JOIN
        `CompanyPCs`.`Partition_has_Filesystem`
        WHERE `Operating_System_has_Kernel`.`Kernel_Kernel_Type` = `Kernel`.`Kernel_Type`
            AND `Operating_System_has_Kernel`.`Kernel_Kernel_version` = `Kernel`.`Kernel_version`
            AND `Filesystem`.`Filesystem_Name` = `Kernel_supports_Filesystem`.`Filesystem_Filesystem_Name`
            AND `Filesystem`.`Filesystem_Name` = `Partition_has_Filesystem`.`Filesystem_Filesystem_Name`
            AND `Partition_has_Filesystem`.`Partition_idPartition` = NEW.`Partition_idPartition`
            AND `Partition_has_Filesystem`.`Partition_HDD_idHDD` = NEW.`Partition_HDD_idHDD` 
            AND `Partition_has_Filesystem`.`Partition_HDD_PC_idPC` = NEW.`Partition_HDD_PC_idPC`
            AND `Partition_has_Filesystem`.`Partition_HDD_PC_roomNr` = NEW.`Partition_HDD_PC_roomNr`),
        SELECT 1 = 1,
        SIGNAL SQLSTATE 'F9F54'
            set MESSAGE_TEXT = 'Filesystem unsupported by OS Kernel');
END; |
DELIMITER ;

but it throw me ERROR 1064 (42000) near SELECT `Operating_System_id_OS` FROM
`CompanyPCs`.`Operating_System_has' at line 4
I know this solution might not be the best one, but I need to do something quickly.

Options: ReplyQuote


Subject
Views
Written By
Posted
Big trigger, small error 1064
2223
December 13, 2010 06:35AM
1239
December 13, 2010 09:55AM


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.