How to Declare table to variable in MARIADB/MYSQL for function/procedure?(如何在 MARIADB/MYSQL 中为函数/过程声明表变量?)
问题描述
不知道如何操作MySQL DECLARE THIS TABLE?
I don't know how to operate MySQL DECLARE THIS TABLE?
MS_SQL CAN
DECLARE @TEMP TABLE
(variable INT)
但是 MySQL
不能这样做!我该怎么做?
But MySQL
can't do this! How can i do it?
语法错误!!
推荐答案
如果您需要使表或数据库名称来自参数或变量,则需要
If you need to make a table or database name come from an argument or variable, you will need to
- 构造查询,可能使用
CONCAT
. PREPARE
查询.执行
查询.DEALLOCATE PREPARE
.
- Construct the query, probably using
CONCAT
. PREPARE
the query.EXECUTE
the query.DEALLOCATE PREPARE
.
这篇关于如何在 MARIADB/MYSQL 中为函数/过程声明表变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!