Any SQL statement that returns values must put its result into one or more variables by using INTO, for example. This means that invoking other functions that return values, or executing statements that return a result set (such as INSERT, UPDATE or DELETE with RETURNING or SELECT) is not possible until the returned values are stored in variables. This means that even a simple block code such as Listing 35 will fail because the value returned by the now() function is implicitly discarded:
testdb=> DO $code$ BEGIN
SELECT now();
END $code$;
ERROR: query has no destination for result data
Listing 35: A throw-away statement that doesn't work
If we have the need to execute a query and throw away its results, the PERFORM statement must be used. This statement can be thought of an alias for SELECT. It is in fact possible to write the query text...