I can assign a value to a variable in several ways:

myVar := (SELECT col FROM table WHERE somecondition...)
myVar := col FROM table WHERE somecondtition...
SELECT col INTO myVar FROM table WHERE somecondition

How do I do any of the above using EXECUTE? I need to be able to assign
the value to a variable, a value returned by a querry on a temporary
table.

So far I have found workaround like this:

myRec record;

FOR rec IN EXECUTE ''SELECT col FROM table WHERE somecondition''
LOOP
        myVar := rec
END LOOP

Obviously, the above SELECT query returns only one row. Still, if is
realy inconvinient to have FOR...LOOP...END LOOP construct for assigning
the value to a variable 'read' from the temporary table.

        Mario


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to