I have created a function that does not give any errors itself but when calling it I get an error. I know I technically don’t need a function but for my scenario I need to be using one.
The error:
QUERY “SELECT (show_date) FROM show” returned more than one row.
CONTEXT: PL/PGSql function change_data_type() line 3 at RETURN
CREATE OR REPLACE FUNCTION change_data_type()
RETURNS date as $$
BEGIN
RETURN DATE(show_date) FROM show;
END;
$$ LANGUAGE PLPGSQL;
SELECT change_data_type;
New contributor
Hayley Gideon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.