oracle在现实世界中(oracle in the real world)

编程入门 行业动态 更新时间:2024-10-28 06:33:58
oracle在现实世界中(oracle in the real world)

我最近在使用mysql几年后开始使用oracle。 我立刻被详细的oracle与mysql的比较感到震惊。 四字查询(如SHOW INDEX IN < table> )在oracle中成为四行查询。

我的问题是: 真正的 oracle DBA如何有效地与oracle交互。 必须有一些方法来为常用命令添加别名(就像在unix shell中一样)。 我发现很难相信他们会输入类似的东西

select index_name, column_name, column_position from user_ind_columns where table_name='MYTABLENAME' order by index_name, column_position

每次他们想要做一些简单的事情就像列出表的索引一样。 否则他们怎么能完成任何工作?

I've recently started using oracle after a few years of using mysql. I was immediately struck by how verbose oracle is compared to mysql. Four-word queries (like SHOW INDEX IN < table> ) become four-line queries in oracle.

My question is: how do real oracle DBAs interact with oracle efficiently. There must be some way to alias commonly used commands (like you do in the unix shell). I find it hard to believe that they would type something like

select index_name, column_name, column_position from user_ind_columns where table_name='MYTABLENAME' order by index_name, column_position

every time they wanted to do something as simple as list the indexes of a table. Otherwise how can they get any work done?

最满意答案

您可以使用像SQL Developer或Toad这样的IDE; 它们具有用于浏览表,索引和其他对象的UI,而无需键入任何命令。

或者在SQL Plus中,您可以简单地将常用查询保存为文件中的脚本,例如,名为show_index的脚本可以包含:

select index_name, column_name, column_position from user_ind_columns where table_name=upper('&TABLENAME.') order by index_name, column_position;

你可以在SQL Plus中运行它,如下所示:

SQL> @show_index Enter value for tablename: mytable

You can use an IDE like SQL Developer or Toad; these have a UI to browse tables, indexes and other objects without typing any commands.

Or in SQL Plus you can simply save commonly used queries as scripts in files, for example a script called show_index could contain:

select index_name, column_name, column_position from user_ind_columns where table_name=upper('&TABLENAME.') order by index_name, column_position;

You would run this in SQL Plus like this:

SQL> @show_index Enter value for tablename: mytable

更多推荐

本文发布于:2023-08-04 14:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1416414.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:现实   世界   oracle   real   world

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!