你能告诉我这个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.
答案 0 :(得分:0)
只需添加功能名称为
的数据库名称your_database_name.getTableColumns(......