Top "Plpgsql" questions

PL/pgSQL is the default procedural language for PostgreSQL.

Return zero if no record is found

I have a query inside a stored procedure that sums some values inside a table: SELECT SUM(columnA) FROM my_…

sql postgresql null plpgsql coalesce
PostgreSQL Exception Handling

I am new to PostgreSQL. Could anybody please correct this query. BEGIN TRANSACTION; BEGIN; CREATE TABLE "Logs"."Events" ( EventId BIGSERIAL …

postgresql plpgsql
PL/pgSQL checking if a row exists

I'm writing a function in PL/pgSQL, and I'm looking for the simplest way to check if a row exists. …

sql postgresql plpgsql postgresql-9.1 exists
Return setof record (virtual table) from function

I need a Postgres function to return a virtual table (like in Oracle) with custom content. The table would have 3 …

sql postgresql stored-procedures plpgsql
How to create function that returns nothing

I want to write a function with pl/pgsql. I'm using PostgresEnterprise Manager v3 and using shell to make a …

postgresql function plpgsql void
Table name as a PostgreSQL function parameter

I want to pass a table name as a parameter in a Postgres function. I tried this code: CREATE OR …

function postgresql plpgsql dynamic-sql identifier
Function with SQL query has no destination for result data

I am trying to create a function that returns a SELECTed resultset. When I call my postgres function like this …

sql postgresql plpgsql
ERROR: unterminated quoted string at or near

While executing below shown trigger code using ANT I am getting the error org.postgresql.util.PSQLException: ERROR: unterminated quoted …

postgresql ant triggers plpgsql
PostgreSQL - Iterate over results of query

I am creating a function in pgsql script language, and what I want to do in this point is iterate …

sql postgresql plpgsql
Loop on tables with PL/pgSQL in Postgres 9.0+

I want to loop through all my tables to count rows in each of them. The following query gets me …

postgresql variables loops plpgsql tablename