2

我试图让标准的 vim :clist, :cope 功能与 vim 一起工作。

具体来说,我正在尝试(但失败)从编译器输出中捕获文件名。

我的 PL/SQL 代码编译好了(好吧,当没有错误时 =),我有 errorformat 拾取错误消息、行号和列号,但我无法获取文件名(vim 需要哪个才能跳转到文件)。

这是我能想到的最好的错误格式:

  :set efm=%+P[%f],%E%l/%c%m,%C%m,%Z   

这是编译器的输出。它只有第一行的文件名(我尝试使用 +P[%f].

输出:

[code/voyager/db/db_source/pck_policy_2.pks]

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 8 14:51:24 2009    
Copyright (c) 1982, 2005, Oracle.  All rights reserved.    
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
Warning: Package created with compilation errors.    
SQL> Errors for PACKAGE PCK_POLICY_2:

LINE/COL ERROR
-------- --------------------------------------------------------------
21/7     PLS-00103: Encountered the symbol "EXP_PBIT_ID" when expecting
         one of the following:
         := . ) , @ % default character
         The symbol "," was substituted for "EXP_PBIT_ID" to continue.

185/1    PLS-00103: Encountered the symbol "END" when expecting one of the
         following:
         constant exception <an identifier>
         <a double-quoted delimited-identifier> table long double ref
         char time timestamp interval date binary national character
         nchar

LINE/COL ERROR
-------- -------------------------------------------------------------

SQL> Disconnected from Oracle Database 11g Enterprise Edition 

:clist 之后显示错误已被捕获,但不是文件名: :clist

19:21 col 7 error: PLS-00103: Encountered the symbol "EXP_PBIT_ID" when expecting one of the following: := . ) , @ % default character The symbol "," was substituted for "EXP_PBIT_ID" to continue.
21:185 col 1 error: PLS-00103: Encountered the symbol "END" when expecting one of the following: constant exception <an identifier> <a double-quoted delimited-identifier> table long double ref char time timestamp interval date binary national character nchar

有谁知道我怎样才能让这个文件名?

谢谢戴夫·斯迈利

4

2 回答 2

1

您使用的语法对我来说看起来不错。所以我能提供的只是想法......

  1. 即使不显示文件名,您仍然可以在快速修复窗口中跳转到正确的行吗?
  2. 编译器是否在文件名之前产生任何输出?在 %+P 之前尝试了 %E?
  3. 即使它不是您要查找的错误格式,您是否尝试过oracle.vim插件?
于 2009-09-09T20:26:01.087 回答
0

对 efm 或 vim 或您尝试执行的解析一无所知,我会说您执行查询以获取错误信息可能会更好。查看视图 user_errors以收集错误信息。使用此方法以您想要的方式获取数据应该更容易。

于 2009-09-09T19:26:35.670 回答