Hello all. I am new to PostgreSQL and trying to write my first function. I followed the samples in documentation and I wrote the function below:
Instead of "today=current_date" I also tried "select current_date into today", and several other things. Here, I expect to see a table with a column containing today's date. But I see an empty table. Could you please tell me what I am doing wrong? Thanks.
Code:
CREATE OR REPLACE FUNCTION TEST() RETURNS TABLE (today DATE) AS'
DECLARE today DATE;
BEGIN
today = current_date;
END;'
LANGUAGE plpgsql;
select * from TEST();