Writing a user defined function - Mailing list pgsql-general

From Suresh_
Subject Writing a user defined function
Date
Msg-id 18532591.post@talk.nabble.com
Whole thread Raw
Responses Re: Writing a user defined function
Re: Writing a user defined function
List pgsql-general
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;
  declare cust scroll cursor for select * from tpcd.customer;
  FETCH FORWARD 5 FROM cust;
end loop;
CLOSE cust;
COMMIT work;
return 1;
end;
$$ LANGUAGE plpgsql;

select udf();

thanks,
Suresh
--
View this message in context: http://www.nabble.com/Writing-a-user-defined-function-tp18532591p18532591.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Reducing memory usage of insert into select operations?
Next
From: Scara Maccai
Date:
Subject: Re: TODO list and "hyphen"