views:

16

answers:

1

Hi All,

CREATE TRIGGER membership AFTER INSERT ON jos_config5 FOR EACH ROW BEGIN INSERT INTO jos_config4( identity_guid, UserID, STATUS , original_conf_path, output_file_path, time_of_process, time_of_start, time_of_completion, status_message, Projectname ) VALUES ( '12', '345', '753', '34', '45', 'NA', 'NA', 'NA', 'User has not started processing...', 'NA')

I am using the PHPMyadmin on executing the getting error as

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 8

Regards, Hemant

A: 

You have a BEGIN with no END. Try this instead:

DELIMITER //
CREATE TRIGGER membership AFTER INSERT ON jos_config5
FOR EACH ROW
BEGIN
    INSERT INTO jos_config4 (
        identity_guid,
        UserID,
        STATUS,
        original_conf_path,
        output_file_path,
        time_of_process,
        time_of_start,
        time_of_completion,
        status_message,
        Projectname )
    VALUES (
        '12',
        '345',
        '753',
        '34',
        '45',
        'NA',
        'NA',
        'NA',
        'User has not started processing...', 'NA');
END;
//
DELIMITER ;

See here for the correct syntax:

http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html

Mike
Thanks Mike........
MySQL Rocks
Can i invoke any external application with triggers.........
MySQL Rocks
@hemant: It's not something I have ever tried, but you might find this useful: [Can triggers call SYSTEM?](http://forums.mysql.com/read.php?99,170973,257815#msg-257815).
Mike
MySQL Rocks