Return value from anonymous function postgresql

arturgspb picture arturgspb · Apr 25, 2012 · Viewed 17.9k times · Source

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.

Answer

vyegorov picture vyegorov · Apr 25, 2012

It is not an anonymous function, but rather anonymous code block.