MySQL: Selecting multiple fields into multiple variables in a stored procedure

后端 未结 3 1340
礼貌的吻别
礼貌的吻别 2020-12-12 18:09

Can I SELECT multiple columns into multiple variables within the same select query in MySQL?

For example:

DECLARE iId INT(20);
DECLARE dCreate DATET         


        
3条回答
  •  粉色の甜心
    2020-12-12 18:20

    Alternatively to Martin's answer, you could also add the INTO part at the end of the query to make the query more readable:

    SELECT Id, dateCreated FROM products INTO iId, dCreate
    

提交回复
热议问题