0

我在 Ubuntu 64 位服务器上运行 PostgreSQL 版本 9.3.4。

我在 HP-UX 上使用 PoatgreSQL ODBC 驱动程序 (libpsqlodbcw) 9.03 版。

我能够连接、检索数据并进行一般续集更新。但是,当我尝试使用 更新游标时SQLSetPOS,出现错误:

Only SQL_POSITION/REFRESH is supported for PGA PI_SetPos

我尝试使用语法select * from table for update of table(以及许多版本)但没有任何效果。

我猜,在这一点上,不支持这样的更新。有人对此有任何意见吗?

4

1 回答 1

1

是的,游标可以更新。

digoal=# begin;
BEGIN
digoal=# declare cur cursor for select * from t;
DECLARE CURSOR
digoal=# fetch next from cur;
 id | phone | cnt 
----+-------+-----
  1 |     1 |   3
(1 row)

digoal=# update t set cnt=1000 where current of cur returning *;
 id | phone | cnt  
----+-------+------
  1 |     1 | 1000
(1 row)

UPDATE 1
digoal=# select * from t where id=1;
 id | phone | cnt  
----+-------+------
  1 |     1 | 1000
(1 row)

digoal=# end;
COMMIT
digoal=# select * from t where id=1;
 id | phone | cnt  
----+-------+------
  1 |     1 | 1000
(1 row)
于 2014-05-12T23:38:50.810 回答