When using PostgreSQL this db API call is designed to execute a select statement that returns a single row, or a set of SQL statements (to mimic a block of code in Oracle.
In the second case the multiple statements are wrapped in a dummy function.
You should either write a wrapper function for your query or do something like "select 1 from (select ...your query...)" to trick db_exec_plsql into executing this.
We supply this kludge so the calling code doesn't have to switch to calling db_0or1row or db_string or the like in the PostgreSQL while calling db_exec_plsql in the Oracle case. Our PG db_exec_plsql allows us to bury the difference in the query file - where it should be.