Re: My function run successfully with cursor, but can't change table
| От | 高健 |
|---|---|
| Тема | Re: My function run successfully with cursor, but can't change table |
| Дата | |
| Msg-id | CAL454F11Y1e1H2iiAL3g2X106pKdLAH5MtSiBcxJmbt0WwGV1A@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: My function run successfully with cursor, but can't change table (Kevin Grittner <kgrittn@ymail.com>) |
| Список | pgsql-general |
Hi :
Sorry for replying lately.
I tried to take the commit statement out of the function , and it works well.
Thank you!
2013/6/10 Kevin Grittner <kgrittn@ymail.com>
高健 <luckyjackgao@gmail.com> wrote:
> CREATE OR REPLACE Function ...
> BEGIN
> BEGIN
> UPDATE ...
> COMMIT;> END;
> EXCEPTION
> WHEN OTHERS THEN
> END;
> But when I select the table again, I found it not changed.> Anybody know the reason, maybe there are some wrong way byIt has nothing to do with the way you are using the cursor; your
> which I use the cursor.
problem is that you are causing an error by attempting to COMMIT
inside a function (which is not allowed). This rolls back the
subtransaction defined by the BEGIN/EXCEPTION block. You then
suppress any display of the error with the WHEN OTHERS block.
--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
В списке pgsql-general по дате отправления: