1

The scheduler seems to be running from INFORMATION_SCHEMA.EVENTS but there is no CSV output.

The event scheduler has to automatically produce a csv to pass on the data to another system. It's like integrating 2 systems through the csv, maybe not the optimum way.

The version of MySQL is 5.6.25. What can be the issue?

The event is as below:

DROP EVENT x.tbl_event;
DELIMITER $$
CREATE EVENT  x.tbl_event
    ON SCHEDULE
      EVERY 30 minute 
DO BEGIN
            select @sent := max(id) FROM x.TBL_COUNT;
            select @val := max(submission_id) FROM x.tbl_form;
             IF @sent < @val THEN
              SET @sql_stmt:= concat("select submission_id, application_type, applicant_name,
             applicant_nic,applicant_email,applicant_address_line1, applicant_address_line2,applicant_tel,
             applicant_mobile,association_name,association_registrationno,
             association_address_line1, association_address_line2,position_applicant,no_members, submission_date, no_of_guests 
             from x.tbl_form where submission_id>@sent and application_type !=''
             INTO OUTFILE 'C:/output", DATE_FORMAT(now(),'%Y-%m-%d_%H%i%s'), ".csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'");
             PREPARE extrct FROM @sql_stmt;
             EXECUTE extrct;
             DEALLOCATE PREPARE extrct;
             INSERT INTO TBL_COUNT(id, datecreated) VALUES(@val, NOW());
            END IF;

END $$
DELIMITER ;

The column last_executed from INFORMATION_SCHEMA.EVENTS seems to indicate that the event gets triggered (and so my code runs), and yet I get no output file.

Andriy M
  • 20,973
  • 6
  • 52
  • 93
mish
  • 11
  • 2
  • Please run `SELECT * FROM information_schema.events WHERE event_schema='x' AND event_name='tbl_event'\G` and post the output – RolandoMySQLDBA Mar 30 '16 at 02:29
  • RECURRING,NULL,30,MINUTE,"STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION","2016-03-24 15:59:26",NULL,ENABLED,"NOT PRESERVE","2016-03-24 15:59:26","2016-03-24 15:59:26","2016-03-30 13:29:26",,1,utf8,utf8_general_ci,utf8_general_ci – mish Mar 30 '16 at 09:43

0 Answers0