display select results inside anonymous block
You can try with this, to print your result easily:
declareyour_variable varchar2(19);BEGINDBMS_OUTPUT.PUT_LINE('init..'); FOR x IN (SELECT your_column FROM you_table where rownum<2 order by 1) LOOP DBMS_OUTPUT.PUT_LINE(x.your_column); END LOOP;END;
In order to return the value of the select it needs to be selected into a container (a reference cursor or REF CURSOR). In your Declare you should include ref_cursor_out SYS_REFCURSOR;
and change your select to:
select * into ref_cursor_out ...
In SQL Developer there is an option (I am a Toad user, so I forget where in SD) that tells the IDE to load the result set into a grid to view.
[edit: per comment from @DCookie, Thanks for the catch!]
For oracle 12c or higher
declare rfc sys_refcursor; begin open rfc for select * from table; dbms_sql.return_result(rfc);end;