Is it possible to output a SELECT statement from a PL/SQL block?
How can I get a PL/SQL block to output the results of a SELECT statement the same way as if I had done a plain SELECT ? For example how to do a SELECT like: SELECT foo, bar FROM foobar; Hint : BEGIN SELECT foo, bar FROM foobar; END; doesn't work. It depends on what you need the result for. If you are sure that there's going to be only 1 row, use implicit cursor: DECLARE v_foo foobar.foo%TYPE; v_bar foobar.bar%TYPE; BEGIN SELECT foo,bar FROM foobar INTO v_foo, v_bar; -- Print the foo and bar values dbms_output.put_line('foo=' || v_foo || ', bar=' || v_bar); EXCEPTION WHEN NO_DATA_FOUND THEN --