I want to create a function that loops through a table, and checks if a specific word exists in a text field. If it does, the function should set a Boolean field true. This is what ive come up with. I guess my execute command is wrong? Thank you very much and best regards.
أكثر...
CREATE OR REPLACE FUNCTION insertCarBooleans() Returns void AS $$ DECLARE location RECORD; BEGIN FOR location IN SELECT * FROM Ownlocations ORDER BY id LOOP EXECUTE 'UPDATE Ownlocations SET Ford = true WHERE cars LIKE 'Ford';
END LOOP; RETURN; END; $$ LANGUAGE plpgsql;
SELECT insertCarBooleans()
END LOOP; RETURN; END; $$ LANGUAGE plpgsql;
SELECT insertCarBooleans()
أكثر...