Toad can display row numbers and ROWIDs in the Editor data grid.
The total number of rows returned in the resultset will display in the status bar at the bottom of the window only after you have scrolled to the end of the resultset. This is because the resultset is fetched only as required, to improve overall performance. When the last row is fetched, Toad will display the total count.
To display row numbers
Select View | Toad Options | Data Grids | Visualand then select Show row numbers (applies to data grid on Browser also).
To return the Oracle pseudo-column ROWNUM in the SQL Results grid
To display ROWIDs
Select View | Toad Options | Data Grids | Dataand then select Show ROWID in editable grids.
You can achieve the same result by adding the following to the query:
select rownum, emp.* from employee emp
Remember that rownum is an Oracle pseudo-column, not stored with the table definition or data, but derived when queried.
To return the ROWID in the query, specify the column and the datatype:
select rowidtochar(rowid), emp.* from employee emp
You can copy the names of selected columns in the data grid to the clipboard. The names are copied in the order they are listed in the grid, for use in WHERE clauses or other tasks where you need a list of column names.
To copy column names
- In the data grid, click (column selector) in the grid header, then select the columns that you want to copy.
- Select the sort order (alphabetical or grid order, the default).
- Right-click the selected column list, then select Copy checked columns to clipboard.
Throughout Toad, information is presented in a grid format. Within grids, you can customize grid views, filter result sets, print the grid contents, and other standard operations. Grids that provide query results have additional functionality. In most data grids you can edit data, perform calculations on grid cells, and sort and group data, among many other things.
A data grid is fully editable providing that the query itself returns a resultset that can be updated. Query statements must return the ROWID to be editable. For example:
Not editable:
select * from employee
Editable:
select employee.*, rowid from employee
Notes:
- You can substitute EDIT for SELECT * FROM. Toad translates it into the editable version of the statement. For example, edit employee returns the same result as select employee.*, rowid from employee.
- If the resultset should be editable but remains read only, make sure the Use read-only queries checkbox is not selected on View | Toad Options | Data Grids | Data options page.