Stupid newb question, flame away

I'm missing something obvious. I have to be.

I've been a SQL Server developer for 20 years, and this week I'm being flung into Oracle. I'm using PL/SQL Developer, which looks vaguely enough like SSMS that I figured it's got to work much the same. I'm trying to create a SQL script that does two things that, for the life of me, I am unable to figure out how to get done at the same time:

1. Uses variables
2. Outputs results to the grid

I can declare variables, use them the way I expect to be able to use them, and using DBMS_OUTPUT.PUT_LINE I can write things to the text-based output pane. Working this way is tedious. I'd like to be able to select my results into the grid, the way that I can out of the box with SSMS. I've spent way too long trying to figure out what I'm doing wrong, and I'm not finding any kind of "For SSMS developers" reference to explain what I'm missing, so here I am. Help? Somebody? What obvious and easy thing did I miss?
 
My guess you are using the Test Window? This window type is primarily intended for testing and debugging PL/SQL program units. You can still view a result set on the "SQL Output" tab page though.

For querying and result set manipulation you should use the SQL Window instead (File > New > SQL Window). Result sets will directly be displayed. It also supports substitution variables, prefixed with an ampersand. For example:

select * from employees where department_number = &dept;

This query will ask for a "dept" value, and will display all employees from this department.

See chapter 7 in the User's Guide for more information about the SQL Window.
 
Back
Top