I have a tool which output is a sql query results. Depending on the user choice query is using subqueries. In order to get all subqueries to my final query I use strings and at the final stage I concat them to one big query - vSQL.
Subqueries are saved in string like vSQL1 .. vSQL14
Since not every subquery is used - user choice - some of them are omitted.
Now it looks like this:
if LENGTH(vSQL1) > 1 then
set_vSQL(vSQL, vSQL1, t);
end if;
..
if LENGTH(vSQL14) > 1 then
set_vSQL(vSQL, vSQL14, t);
end if;
Is it possible to put it into loop so only variable would change?
I tried something like this but this is not working.
for x in 1 .. 14
loop
if LENGTH(vSQL || x) > 1 then
set_vSQL(vSQL, vSQL || x, t);
end if;
end loop
set_vSQLis about to do? You say "Subqueries are saved in string like vSQL1 .. vSQL14" - Why can't it be concatenated while saving?