mysql>
mysql> delimiter $$
mysql>
mysql> CREATE PROCEDURE filesize(in_file_name VARCHAR(128))
->
-> BEGIN
-> DECLARE mytext TEXT;
-> SET mytext=LOAD_FILE(in_file_name);
-> SELECT in_file_name||' contains '||length(mytext)||' bytes'
-> AS output;
-> END$$
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> delimiter ;
mysql> call filesize("a.txt");
+--------+
| output |
+--------+
| NULL |
+--------+
1 row in set (0.00 sec)
Query OK, 0 rows affected, 2 warnings (0.00 sec)
mysql> drop procedure filesize;
Query OK, 0 rows affected (0.00 sec)
mysql>