Thanks. I searched for it and I found something. It tells me to use the perl module. But Tom Lane mentions using the execute command see(http://archives.postgresql.org/pgsql-general/2001-03/msg01614.php).
Since I have no interest in picking up yet another language, I tried this:
qry := ''select * from ''|| trim(realname) ||'' where ''|| trim(searchfield) ||'' like ''''%''|| trim(searchvalue) ||''%'''''';
arrayval := string_to_array(coltoparammatch(3, talias, insertparams, insertdelimiter), '','');
for objectdefinition in execute qry loop
for i in array_lower(arrayval, 1)..array_upper(arrayval, 1) loop
qry := ''select into aliasvalue objectdefinition.''|| arrayval[i];
execute qry;
RAISE NOTICE ''field = %'', aliasvalue;
end loop;
end loop;
arrayval := string_to_array(coltoparammatch(3, talias, insertparams, insertdelimiter), '','');
for objectdefinition in execute qry loop
for i in array_lower(arrayval, 1)..array_upper(arrayval, 1) loop
qry := ''select into aliasvalue objectdefinition.''|| arrayval[i];
execute qry;
RAISE NOTICE ''field = %'', aliasvalue;
end loop;
end loop;
I tried to execute a dynamic sql string using the dynamic record column name but I getting this error: ERROR: syntax error at or near "into" at character 8. Does the execute statement not allow the into keyword into or am I not quoting right?
TIA
Alex
Christopher Kings-Lynne <[EMAIL PROTECTED]> wrote:
Christopher Kings-Lynne <[EMAIL PROTECTED]> wrote:
> Was wondering if there was anything akin to an evaluate statement in
> Postgresql for dynamic strings?
By dint of tricky programming you can a function that can generate and
execute arbitrary strings. I believe there's even an example of this in
the docs.
Chris