【发布时间】:2017-03-25 07:15:29
【问题描述】:
你能告诉我这个 MySQL 函数有什么问题吗?
我点击链接How can I “select *” from a table in MySQL but omit certain columns?在 MySQL 中定义了一个函数。但我收到一个错误“未选择数据库”。
DELIMITER $$
CREATE FUNCTION getTableColumns(_schemaName varchar(100), _tableName varchar(100), _omitColumns varchar(200)) RETURNS varchar(5000)
BEGIN
SELECT REPLACE(GROUP_CONCAT(COLUMN_NAME), '_omitColumns,', '')
FROM information_schema.columns
WHERE table_schema = _schemaName AND table_name = _tableName
INTO results;
RETURN results;
END$$
Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar.
【问题讨论】:
标签: mysql