Bug #6858 Missing important command in SP : EXEC()
Submitted: 27 Nov 2004 18:29 Modified: 12 Feb 2006 12:27
Reporter: Gwendal van Hooland Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0.1 OS:Any (All)
Assigned to: CPU Architecture:Any

[27 Nov 2004 18:29] Gwendal van Hooland
Description:
SPs are really a great enhancement in MySQL 5, but I was disappointed it is impossible to perform a system command from within a SP. It is very handy for data preprocessing for instance.

EXEC(' *place here commande line to launch my application* ') in Oracle style.

It would be GREAT if another parameter should specify whether to wait for the application has done its work or to continue SQL treatments without waiting.

Example : I receive files YYYYMMDD.txt
I start my SP leading to a LOAD DATA INFILE.
Should be handy to check whether the file is here or not.

How to repeat:
MySQL should cooperate/interact with the OS via command line instructions launched from MySQL instead of remote controlling MySQL from Java for instance.
[4 Nov 2005 11:07] Beat Vontobel
I understand this could be really useful in some circumstances, I'd even like to execute a system command myself sometimes from within the database. But I'm still not sure if I really want to have this in the database: It could open huge security issues. It would give the possibility to write a MySQL worm very easily by just calling the mysql command line client from within the database and trying to connect to other database systems. Of course one could avoid this by carefully defining the access rights: But I know already this would be neglected on probably 95% of the installations.
[12 Feb 2006 12:27] Valeriy Kravchuk
Thank you for the feature request. Sorry, but I do not think it should be implemented. You can create a UDF, if you really want to do things like that (see http://dev.mysql.com/doc/refman/5.0/en/adding-functions.html for the details).

EXEC is NOT a SQL statement in Oracle, by the way. There is a command supported by SQL*Plus command-line interface for tasks like you described, but it is called HOST. EXEC is for other purpose there.