This example is the same as the previous example, except
it uses pg_execute instead of pg_exec to
query the database. pg_execute
is simpler to use
in some circumstances, but less flexible since it does not return
a result handle.
In this example, we use the fact that pg_execute
will
store the query values as variables named by the result column names
(if not given the -array name
option), and if the query
returns a single row there is no need for a procedure body.