這是我的函數聲明和身體的一部分:PL/pgSQL的SELECT到數組
CREATE OR REPLACE FUNCTION access_update()
RETURNS void AS $$
DECLARE team_ids bigint[];
BEGIN
SELECT INTO team_ids "team_id" FROM "tmp_team_list";
UPDATE "team_prsnl"
SET "updt_dt_tm" = NOW(), "last_access_dt_tm" = NOW()
WHERE "team_id" IN team_ids;
END; $$ LANGUAGE plpgsql;
我想team_ids
是整數,我就可以在UPDATE
語句中使用的數組。這個功能給我的錯誤是這樣的:
psql:functions.sql:62: ERROR: syntax error at or near "team_ids"
LINE 13: AND "team_id" IN team_ids;
我認爲你的訂單中的訂單錯誤。不應該這樣:'SELECT team_id INTO team_ids FROM tmp_team_list;' – 2012-07-31 07:26:28