Shavonne Marietta Wijesinghe wrote: > I wrote the query in the SQL windows provided by the pgadmin.
That SQL window only executes SQL, so you can't use PL/pgSQL commands on it. PL/pgSQL can only be used in the context of a PL/pgSQL function, so you need to do CREATE FUNCTION to do that. If you want to use the SQL window you could use SAVEPOINT and ROLLBACK TO. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq