Janice
Janice

Reputation: 176

Reading CSV file in stored procedure and compare with existing table in MYSQL

I have a CSV file, and would like to do a comparison with an existing table to make sure that the fields are updated correctly. (Someone else did the update of the table, I'm just checking if it's updated correctly)

I understand that I can load the csv into a table before doing the comparison but would like to explore if there's any other way to READ the CSV without loading it into a new table.

I'm planning to create a stored procedure to do the comparison, would like to know if it's possible to READ the CSV in stored procedure and do the comparison with the table directly?

Thank you!

Upvotes: 1

Views: 1484

Answers (1)

Shadow
Shadow

Reputation: 34231

No, you cannot read a csv file in a mysql stored procedure without loading into a table with mysql's standard functionality.

The only option you have is to write or find a compiled user defined function that can do this operation or you need to modify mysql's source code.

These options are probably an overkill, so you are better off doing this reconciliation check in an external programming language.

Upvotes: 2

Related Questions