Re: [GENERAL] My function run successfully with cursor, but can't change table

2013-06-13 Thread 高健
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 > 高健 wrote: > > > CREATE OR REPLACE Function ... > > > BEGIN > > BEGIN > > > UPDATE ... > > COMMIT; > > > EXCEPTION > > WHEN OTHERS TH

Re: [GENERAL] My function run successfully with cursor, but can't change table

2013-06-10 Thread Alvaro Herrera
Thomas Kellerer wrote: > Kevin Grittner wrote on 10.06.2013 15:19: > >It has nothing to do with the way you are using the cursor; your > >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 t

Re: [GENERAL] My function run successfully with cursor, but can't change table

2013-06-10 Thread Thomas Kellerer
Kevin Grittner wrote on 10.06.2013 15:19: It has nothing to do with the way you are using the cursor; your 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

Re: [GENERAL] My function run successfully with cursor, but can't change table

2013-06-10 Thread Kevin Grittner
高健 wrote: > CREATE OR REPLACE Function ... > BEGIN >   BEGIN > UPDATE ... > COMMIT; >   EXCEPTION >   WHEN OTHERS THEN >   END; > END; > But when I select the table again, I found it not changed. > Anybody know the reason, maybe there are some wrong way by > which I use the cursor.

[GENERAL] My function run successfully with cursor, but can't change table

2013-06-09 Thread 高健
Hello: Would somebody please kindly tell why my function run but can't update table via cursor: I have table like this: create table course_tbl(course_number integer, course_name varchar(4), instructor varchar(10)); insert into course_tbl values (1,'','TOM'), (2,'','JACK');