Re: Writing a user defined function

From: "Douglas McNaught" <doug(at)mcnaught(dot)org>
To: Suresh_ <suiyengar(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Writing a user defined function
Date: 2008-07-18 16:29:31
Message-ID: 5ded07e00807180929p515da454t87c501324065420e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 18, 2008 at 12:07 PM, Suresh_ <suiyengar(at)yahoo(dot)com> wrote:
>
> Hello,
> I am trying to code a simple udf in postgres. How do I write sql commands
> into pl/sql ? The foll. code doesnt work.
>
> CREATE OR REPLACE FUNCTION udf()
> RETURNS integer AS $$
> BEGIN
> for i in 1..2000 loop
> for j in 1...10000 loop
> end loop;
> begin work;

Postgres doesn't let you do transactions inside a function.

Take out the BEGIN and COMMIT, and if you still get errors post the
function code and the error message that you get.

-Doug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Glyn Astill 2008-07-18 16:30:42 Re: Initdb problem on debian mips cobalt: Bus error
Previous Message Alvaro Herrera 2008-07-18 16:23:02 Re: Reducing memory usage of insert into select operations?