MySQL Forums
Forum List  »  Stored Procedures

Re: INSERT DYNAMIC SQL DOESNT GET VALUES
Posted by: Luis Badillo
Date: May 15, 2018 11:05AM

Hi!, Peter, my problem is not the semicolom, because of I run in console or using MySQL Workbench works, my problem is in this part.

SET @consulta_respaldar_tabla=CONCAT("SELECT 'INSERT LOW_PRIORITY INTO Call_Center_Infinit_",param_id_empresa,".",
param_nombre_tabla_respaldar,"(",@columnas_tabla,") VALUES(`",@columnas_tabla,"`);'
INTO OUTFILE '/var/lib/mysql/respalda_datos_tbl_",param_nombre_tabla_respaldar,"_",DATE_FORMAT(CURRENT_TIMESTAMP(),'%d%b%Y_%H%i'),".sql'
FIELDS TERMINATED BY '\t'
OPTIONALLY ENCLOSED BY '""'
LINES TERMINATED BY '\n'
FROM ",param_tabla_comparar,"
INNER JOIN ",param_nombre_tabla_respaldar,"
ON ",param_tabla_comparar,".id=",param_nombre_tabla_respaldar,".",param_nombre_columna,"
WHERE ",param_tabla_comparar,".id_empresa=",param_id_empresa,";");

I am tying to execute this dynamic query but when I run this store procedure and dump into a file, the file print everything ok but in the values print the column names instead of column values

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: INSERT DYNAMIC SQL DOESNT GET VALUES
660
May 15, 2018 11:05AM


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.