开发者

Automatically inserting column names for table in TOAD for Oracle

I am looking for a way to automatically insert column na开发者_Go百科mes in TOAD for Oracle to make it easier for writing queries.

Ideally, I would like to type something like the following:

select * from myTable;

Then, when I right-click on *, I would have the option to insert all known column names for that table.

Is it possible in Toad?


Press F4 on that the selected table name, and in the schema browser, select the Columns tab, then select all columns. Then drag the selection, do not copy&paste, back into the editor, and you have your comma separated column names.


select column_name || ','
from all_tab_columns
where table_name = 'SOME_TABLE'
and owner = 'SOME_OWNER'
order by column_id;

The right click on output of field names in data grid and select Export Data (to clipboard as tab delimited, don't include quoting or column headers).

Now copy/paste where u need it. Nice thing is that you can:

  1. Use this SQL in any IDE, not just Toad
  2. Modify output if needed, as I do in triggers to add ':old' or ':new' prefixes to each field for example, or change order.


It is also possible to generate the statement from the schema browser-> columns tab

Select the columns you want, then right click and select the 'generate statement' menu item,then select the command you want to generate (Select/Insert/Delete).

The script then gets copied to clipboard, for you to paste at your leisure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜