How export table data using stored procedure
Posted by:
jijo ac
Date: January 15, 2019 04:51AM
We need to export some table’s data into file. We are selecting the table names programmatically. So we are trying to do this using a procedure, we have created a sample procedure
DELIMITER $$
CREATE PROCEDURE export_dynamic()
BEGIN
set @myvar = 'SELECT * INTO OUTFILE ''E:\\MYSQL-DUMP\\tabletest.txt'' FROM tabletest;
PREPARE STMT FROM @myvar;
EXECUTE STMT;
DEALLOCATE PREPARE STMT;
END;
$$
But when we CALL this procedure we are getting following Error
CALL export_dynamic() Error Code: 1. Can't create/write to file 'E:MYSQL-DUMP abletest.txt' (Errcode: 22 - Invalid argument) 0.000 sec
When we run the following query In MySQL workbench works fine
SELECT * INTO OUTFILE 'E:\\MYSQL-DUMP\\tabletest.txt' FROM tabletest
Is there any way to export a table using mysql procedure?
Subject
Views
Written By
Posted
How export table data using stored procedure
4346
January 15, 2019 04:51AM
921
January 15, 2019 11:00AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.