我試圖創建以下函數。功能已成功創建,但試圖調用它時的投擲錯誤類型EXECUTE在postgresql查詢中不存在
type EXECUTE does not exist!
CREATE OR REPLACE FUNCTION exa(ids text, length integer, fields text) returns text AS
$BODY$
DECLARE
chars INT[] := string_to_array(ids, ',');
result text := '';
i integer := 0;
temp text := '';
BEGIN
for i in 1..length loop
temp := EXECUTE 'SELECT ' || fields || ' from user_index where userid=' || chars[i];
result := result || temp;
IF i < length THEN
result := result || ',';
END IF;
end loop;
return result;
END
$BODY$ language plpgsql;
嘗試EXEC代替EXECUTE –
@phpdeveloperbalaji沒有運氣 – ray
@phpdeveloperbalaji:「EXEC」只是無稽之談。 –