How to echo print statements while executing a sql script

前端 未结 6 1796
执笔经年
执笔经年 2020-12-09 00:58

We have a simple sql script which needs to be executed against a MySQL database and we would like print log statements on the progress of the script (e.g. Inserted 10 record

6条回答
  •  心在旅途
    2020-12-09 01:53

    Just to make your script more readable, maybe use this proc:

    DELIMITER ;;
    
    DROP PROCEDURE IF EXISTS printf;
    CREATE PROCEDURE printf(thetext TEXT)
    BEGIN
    
      select thetext as ``;
    
     END;
    
    ;;
    
    DELIMITER ;
    

    Now you can just do:

    call printf('Counting products that have missing short description');
    

提交回复
热议问题