PL/SQL 中的代码导航工具
我必须研究和修改一个用 pl/sql 编写的大型且文档缺乏的代码库。我使用 Oracle SQL Developer 来浏览它,但它变得乏味,因为没有“转到声明”或“查找用法”选项,所以我必须手动转到引用的包来查找我想要理解的函数或过程,或 grep 离线副本以查找用法。
我尝试过设置 vim+ctags,但是丰富的 ctags 因不区分大小写而感到困惑。
那么问题是,哪些工具可以轻松浏览 PL/SQL 代码?
I have to study and modify a big and poorly documented codebase written in pl/sql. I use Oracle SQL Developer to navigate through it, but it become tedious because there is not a "go to declaration" nor "find usages" option so I have to go manually to the referred package to find the function or procedure I want to understand, or grep an offline copy to find the usages.
I have tried to setup vim+ctags, but exuberant ctags gets confused by case insensitiviness.
So the question is, which tools allow to easily navigate through PL/SQL code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Allround Automations 的 PL/SQL Developer 具有一些很好的代码导航功能。您可以下载并安装可使用一个月的全功能试用版。之后,如果您喜欢该工具并想继续使用它,则必须支付(适度的)费用。
PL/SQL Developer, from Allround Automations has some nice features to navigate through code. You can download and install a full-feature trial version that will last you one month. Afterwards, if you like the tool and want to go on using it, you will have to pay a (modest) fee.
尝试Tobys PLSQL Editor。它为您提供:
我仍在寻找一个好的工具来查看依赖关系。您可以查询数据字典来查找包依赖项,但它不会深入到包本身内的过程/函数级别或每个包内的行号。
Try Tobys PLSQL Editor. It gives you:
I'm still searching for a good tool to look at dependencies. You can query the data dictionary to find package dependencies but it doesn't go down to the level of procedures/functions within the packages themselves or line numbers within each package.
Exuberant ctags能够为PL/SQL存储过程生成ctags文档,并且有大量的编辑器可以读取标签回来了,包括Emacs和vi等经典。我个人将它与 Sublime Text 2 一起使用来处理 3000 多行的大型存储过程定义。 (ST2 是一个很棒的全能编辑器,但在编辑 SQL 方面并不比任何其他编辑器特别好,它具有基本的代码突出显示功能,仅此而已。)
Exuberant 标签的唯一问题是它只会生成单个标签条目,即使它多次看到定义,因此,如果您将包声明和包主体放在同一个文件中,标签只会跳转到第一个条目(通常是声明)。
Exuberant ctags is able to generate ctags documents for PL/SQL stored procedures, and there are tons of editors which can read the tags back, including such classics as Emacs and vi. I personally use it with Sublime Text 2 working on big 3000+ line stored procedure definitions. (ST2 is a great all-around editor, but not particularly better than any other editor for editing SQL, it has basic code highlighting and that's all.)
The only problem I've got with Exuberant's tags is that it will only generate a single tag entry even if it sees the definitions more than once, so that if you put your package declaration and your package body in the same file, the tags will only jump you to the first entry (usually the declaration).
我最近从 Oracle 的 SQL Developer 切换到 Quest 的 TOAD 我喜欢它! TOAD 我最喜欢的是调试工具。我使用的功能可以在这两个产品中找到,但 TOAD 对我来说更容易使用,但 SQL Developer 是“免费”的。
I have recently switched from Oracle's SQL Developer to Quest's TOAD and I love it ! What I like most about TOAD is the debuging tool. The capabilities I use can be found in both products but TOAD to me is a little easier to use, but SQL Developer is "free".
请参阅 SD 源代码搜索引擎,该工具在大型正文中的搜索速度比 grep 快得多源代码,通过对源代码进行预索引。搜索引擎对语言敏感,因此您可以根据语言标识符、数字、关键字和运算符形成查询。空格和注释不会欺骗它。
它适用于 PL/SQL 以及许多其他语言(C、C++、C#、COBOL、Java...)。
See the SD Source Code Search Engine for a tool which does searches far faster than grep over large bodies of source code, by preindexing the source code. The Search Engine is language sensitive, so you can form queries in terms of langauge identifiers, numbers, keywords, and operators. Whitespace and comments don't fool it.
It works for PL/SQL as well as many other languages (C, C++, C#, COBOL, Java, ...).
我将 PL/SQL 包从数据库导出到文件系统中以进行版本控制(我使用 Git)。包(主体和规范)都位于同一目录中。
我使用 Visual Studio Code(当前版本 1.53.2)编辑包,因为 VS Code 对 Git 有很好的支持。
右键单击过程会打开上下文菜单,
转到定义
(或 F12)会跳转到该过程,即使它是在另一个包中声明的。您可以通过单击菜单“Go -->”跳回返回(或 Alt+向左箭头)。
I export my PL/SQL-Packages from the database into the file system for version control (I use Git). The packages (body and specification) are all within the same directory.
I edit the package with Visual Studio Code (currently version 1.53.2), because VS Code has a great support for Git.
A right click on a procedure opens the context menu and
Go to definition
(or F12) jumps to the procedure even if it was declared in another package.You jump back by clicking on the menu Go --> Back (or Alt+LeftArrow).
JetBrains 的 DataGrip 是另一种选择。您可以通过单击函数名称旁边的图标从包函数规范导航到其在正文中的实现。它的体验与Oracle SQLDeveloper非常相似。
JetBrains' DataGrip is another option. You can navigate from the package function spec to its implementation in the body by clicking the icon next to the function name. Its experience is very similar to Oracle SQLDeveloper.