> How do I write transaction statements like 'BEGIN
> WORK'... in PLPGSQL.
You can't... the function is already running within a transaction (implicit
or explicit) and PostgreSQL doesn't have any nested transactions, therefore
you can't start a transaction from within a function.
> Also how do I write lock statements in the same.
I'm not sure what you're trying to do, but I think SELECT ... FOR UPDATE
would work in this context.
Greg