Is there any way to define database identifiers returned by a query as constants in order to reuse them in another query?
Like table name or column name etc.
Well, you can store the returned value in variables. If your query returns multiple database / table names, then you probably need a cursos to loop through the resultset and process database / table names one by one. However, if you would like to use the returned names in another query, then you have to concatenate the query statement as text and used prepared statement to execute it. See the following answer for an example: stackoverflow.com/a/37314063/5389997
@Shadow Thank you, but I am new to SQL, can you explain, what does this line means, SET @queryText = CONCAT('UPDATE ', TableName, ' SET ', UpdateColumn, '=', QUOTE(UpdateValue), ' WHERE ', WhereColumn, '=', QUOTE(WhereValue)); Is it not going to give error code:1248
SET @queryText = CONCAT('UPDATE ', TableName, ' SET ', UpdateColumn, '=', QUOTE(UpdateValue), ' WHERE ', WhereColumn, '=', QUOTE(WhereValue));Is it not going to give error code:1248