vimplsqlerrorformat

Vim errorformat / efm for PL/SQL


Im trying to get the standard vim :clist, :cope functionality working with vim.

Specifically, I'm trying (and failing) to capture the filename from the compiler output.

I have the PL/SQL code compiling okay (well, when there is no errors =), and I've got errorformat picking up the error messages, line numbers and column numbers, but I can't get it to pick up the filename (which vim needs in order to be able to jump to the file).

This is the best errorformat I've been able to come up with:

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

This is the output from the compiler. It only has the filename on the first line (which I try and pick up with the +P[%f].

output:

[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 afterwards shows the errors have been caught, but not the filename: :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

Does anyone know how I can make this pick up the filename?

Thanks Dave Smylie


Solution

  • The syntax you're using looks OK to me. So all I have to offer is thoughts...

    1. Even though the file names are not displayed, can you still jump to the correct line in the quickfix window?
    2. Does the compiler produce any output before the file name? Tried a %E before the %+P?
    3. Even though it's not the error format you are looking for, have you tried the oracle.vim plugin?