Re: Writing a user defined function

Поиск
Список
Период
Сортировка
От Suresh_
Тема Re: Writing a user defined function
Дата
Msg-id 18551845.post@talk.nabble.com
обсуждение исходный текст
Ответ на Re: Writing a user defined function  ("Douglas McNaught" <doug@mcnaught.org>)
Ответы Re: Writing a user defined function  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Список pgsql-general
I get this error

ERROR:  syntax error at or near "cursor"
CONTEXT:  invalid type name "scroll cursor for select * from tpcd.customer"
compile of PL/pgSQL function "udf" near line 5


Douglas McNaught wrote:
>
> On Fri, Jul 18, 2008 at 12:07 PM, Suresh_ <suiyengar@yahoo.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
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>

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


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Initdb problem on debian mips cobalt: Bus error
Следующее
От: "Pavel Stehule"
Дата:
Сообщение: Re: Writing a user defined function