Return value from anonymous function postgresql

anonymous-function, plpgsql, postgresql

Solution

DO LANGUAGE plpgsql $$ DECLARE
BEGIN
execute '
create temporary table t
as
SELECT NOW()
';
END $$;

select * from t;

Problem

How to? For easy example. I have a simple function: ``` DO LANGUAGE plpgsql $$ DECLARE BEGIN EXECUTE 'SELECT NOW()'; END $$; ``` How I can return value of "NOW()" or other values from also anonymous function? The function is given as an example I have a more complex function.

Original source

Related problems