mysql store procedure text fili

0

In MySQL using sqlworkbench, how can I create a procedure for a table to get the input value (only the first 100 rows) from the text file and store it in the database?

For example: in the text the values like (12, abc, heg, 258) like 100 rows.

Please help me with this.

I have tried:

use test;
drop procedure if exists `ptable`;
DELIMITER $$ 

create definer =`root`@`localhost` procedure `ptable`() 
begin
load data local infile 'C:\Documents and Settings\Sridevi\tablevalue.txt' 
into table test.testtbl
fields terminated by  '|' 
lines terminated by '\n' 
(sno , city , state , dist, pin )
end $$ 

DELIMITER ;

but the error like load data is not allowed in the store procedure.

i am using MySQL Workbench..

Benny

Posted 2013-12-12T10:21:05.967

Reputation: 101

You didn't research too much... the first result of googling "load data not allowed in stored procedures" gives you the answer: http://stackoverflow.com/questions/17273030/load-data-is-not-allowed-in-stored-procedures-how-i-solved-this

– m4573r – 2013-12-12T10:45:43.823

ya i know that.explain me is there any other way we can retrieve the data from text using procedure. – Benny – 2013-12-12T11:35:00.457

There isn't. You just have to use something else than a stored procedure. – m4573r – 2013-12-12T11:53:06.097

No answers