It would be nice, if the SQL task would be able to automatically propagate values from SELECTs to ant properties. Now, you have to write the output to a file and parse it manually. That's a big overhead just to get the value for: SELECT a from b where b.id = 1
One suggestion is to use <scriptdef> and talk to the JDBC layer, and set the property from there.