I am trying to run a dynamic query like this (just an idea):
declare
params text[] ;
begin
params := ARRAY['30', 'sometext'];
return execute QUERY 'select id, label from "content" where id>$1 and label = $2' using params;
end ;
The thing is, that my params array can have variable length - I can prepare an appropriate select query, but I would like to execute it using "using" clause, with the array containing all parameters marked with $.
Would be something like that possible or should I build the entire select statement with values already put in a statement (however, this is what I would like to avoid).
$1
(forID
) and what about forlabel
? I think there is another good method can be used for your case. – winged panther Sep 12 '14 at 10:47