I have a function with a dynamic copy statement and when I try to SELECT function, I get the error "query has no destination for result data"
select loadTodaysData();
CREATE FUNCTION loadTodaysData()
RETURNS VARCHAR(1000) AS $$
DECLARE vtoday VARCHAR(20) DEFAULT CURRENT_DATE;
BEGIN
EXECUTE 'COPY nsn
FROM ''C:\Users\yuju\SQL_Data\test_''|| vtoday || ''.csv''
with delimiter ','
csv header';
END; $$
language plpgsql;
I want this to update my table everyday automatically from a folder. Function was created without an error.