Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need Help to Display PL/SQL SELECT in SQL Developer/TOAD Query Results

user6732579May 22 2012 — edited May 22 2012
Hello. I do not know if this is possible, but I am trying to use an anonymous PL/SQL block to create a function, and then use that function in a SQL statement. I would like the results of the query to be displayed in the "Query Results" windows of SQL Developer or Toad. I know I can print the results using DBMS_OUTPUT, but this is not what I want. Lastly, some people might ask why I want to use an anonymous block, but I am an analyst (not a DBA), so I do not have CREATE privileges.

Here is a quick example of what I am trying to accomplish:
DECLARE

FUNCTION some_function(x NUMBER) RETURN NUMBER IS
BEGIN
return x;
END;

BEGIN
--I know I can do this, but I don't want to print it:*
dbms_output.put_line(some_function(100));

--I would like to display onto the SQL Developer/Toad grid result,*
--similar to just executing a select statement. This does not work:*
SELECT some_function(100) FROM tbl_accts;

END;

Thank you very much in advance for the help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2012
Added on May 22 2012
8 comments
913 views