I have this stored procedure: sp_data
with this structure:
BEGIN
SELECT
.
.
.
order by ... ;
END
This stored procedure works fine.
I am currently exporting the results of the stored procedure to a .csv
file and then importing the table into MySQL.
What I'm looking for: Stop exporting and importing data. I need to add something to the stored procedure that creates a table and if it exists, it uses DROP
to make it run again and keep it always updated.
I tried to create an empty table data
with the same data types as the columns to use:
INSERT INTO data (column1, column2,...)
SELECT (same structure as sp_data)
the SELECT
part is fine, but when executing it with INSERT INTO
there is an error:
Data truncation: Truncated incorrect DOUBLE value: ''
And I can't modify the SELECT
of sp_data
because someone else did it and other people use it in the company. That's why I'm looking to add what I put above.
CodePudding user response:
Use the IGNORE
option to downgrade the error to a warning.
INSERT IGNORE INTO data (column1, column2,...)
SELECT (same structure as sp_data)