MySQL Forums
Forum List  »  Stored Procedures

Re: set the value of AS clause name in stored procedure
Posted by: Peter Brawley
Date: December 25, 2020 11:08AM

Simplest possible example given table t(i,j)...

set @sql = "select i as 'first column',j as 'second column' from t";
prepare stmt from @sql;
execute stmt;
+--------------+---------------+
| first column | second column |
+--------------+---------------+
|            2 |             2 |
+--------------+---------------+
drop prepare stmt;

In your case you'd concat strings as required to assemble @sql.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: set the value of AS clause name in stored procedure
406
December 25, 2020 11:08AM


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.