Can you tell me what's wrong with this MySQL function?
I followed the link How can I “select *” from a table in MySQL but omit certain columns?to define a function in MySQL. But I got an error "no database selected".
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.