Hi Im new to mysql and need to know how to write an output file from mysql stored procedure. I basically want to select some data from a table and write the result to an output file on the server. I tried the below procedure which seems to run without error, but I never see the file written to the server. Im using mysql 5.1 on Windows XP pro.
create procedure output_file (p1 varchar(1))
select col1, col2, col3
where col1= p1
into outfile 'outfile1.txt';
When I call the above procedure it runs without error, but no file is generated.
However if I run the procedure a second time it gives an error:
ERROR 1086 (HY000): File 'outfile1.txt' already exists.
I tried running the select into file from the command line outside of the procedure and the same thing happens.