有没有办法可以使用dblink使用server2 / database2上另一个表中的值来更新server1 / database2中的列?
答案 0 :(得分:1)
可能有更好的解决方案,但同时你可以试试这个。
SELECT INTO DUMMY dblink_connect('host=localhost port=5432 dbname=DBNAME
user=USERNAME password=PASSWORD');
SELECT INTO DUMMY dblink_open('PARAMS', 'SELECT VALUE FROM TABLE');
LOOP
SELECT INTO ONE_PARAM RES.VALUE
FROM (
SELECT * FROM dblink_fetch(''PARAMS'', 1) AS (VALUE VARCHAR(100))) RES;
EXIT WHEN NOT FOUND;
/*DO UPDATE HERE*/
END LOOP;
SELECT INTO DUMMY dblink_close(''PARAMS'');