0

I have one stored procedure and it is getting error when I'm uploading the csv or text file using stored procedure.

Can you please help me? How can I write the stored procedure and have one auto-increment column? Please let me know how we will skip unwanted columns using the stored procedure.

CREATE PROCEDURE sp_cat_order_report_gen_meor
begin 
LOAD DATA LOCAL INFILE 'C:\\Users\\VikasK\\Downloads\\vikas\\FINRACATReportableEquitySecurities_EOD.txt'
INTO TABLE tbl_catreportableeqsymbolmaster
FIELDS TERMINATED BY '|' 
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
SET tbl_catreportableeqsymbolmaster.symbolid =null ;
END 
//
delimiter ;

Please let me know.

STLDev
  • 5,459
  • 21
  • 33
  • generally you can't use `LOAD DATA` inside a procedure. If you need other than this please share some sample data with expected result set. – James Dec 19 '19 at 06:41
  • Does this answer your question? [How to skip columns in CSV file when importing into MySQL table using LOAD DATA INFILE?](https://stackoverflow.com/questions/2139069/how-to-skip-columns-in-csv-file-when-importing-into-mysql-table-using-load-data) – P.Salmon Dec 19 '19 at 08:31
  • No its not answer of my question :( – vikas kumbhar Dec 19 '19 at 08:47
  • OK. Then please expand on your question by supplying sample data from the csv file, the target table definition and a note of the columns you do not wish to load. – P.Salmon Dec 19 '19 at 08:50
  • I have 4 columns , in first column i used auto increment for first column. I need to import the data from csv to table using stored procedure>> >>here i have some data from csv. symbol | issueName| listingExchange | testIssueFlag A | Agilent Technologies Inc.| N | N. please suggest.. – vikas kumbhar Dec 19 '19 at 08:54
  • before creating a sp try without that. – James Dec 23 '19 at 05:39
  • Without sp its working fine but using sp its not working – vikas kumbhar Dec 24 '19 at 09:58

0 Answers0